/Regift

Easily convert a video to a GIF on iOS.

Primary LanguageSwiftMIT LicenseMIT

Regift

Easily convert a video to a GIF on iOS and OSX.

Travis Version License Platform Carthage compatible




🚀

I also make Rocket, an app that gives you Slack-style emoji everywhere on your Mac.


Demo image of Rocket





Installation

Cocoapods

Regift is available through CocoaPods, and requires Swift 2. To install it, simply add the following line to your Podfile:

pod "Regift"

Carthage

Regift is available through Carthage.

github 'matthewpalmer/Regift'

Quick Start

import Regift

Synchronous GIF creation:

let videoURL   = ...
let frameCount = 16
let delayTime  = Float(0.2)
let loopCount  = 0    // 0 means loop forever

let regift = Regift(sourceFileURL: videoURL, frameCount: frameCount, delayTime: delayTime, loopCount: loopCount)
print("Gif saved to \(regift.createGif())")

let startTime = Float(30)
let duration  = Float(15)
let frameRate = 15

let trimmedRegift = Regift(sourceFileURL: URL, startTime: startTime, duration: duration, frameRate: frameRate, loopCount: loopCount)
print("Gif saved to \(trimmedRegift.createGif())")

Asynchronous GIF creation:

let videoURL   = ...
let frameCount = 16
let delayTime  = Float(0.2)
let loopCount  = 0    // 0 means loop forever

Regift.createGIFFromSource(videoURL, frameCount: frameCount, delayTime: delayTime) { (result) in
    print("Gif saved to \(result)")
}

let startTime = Float(30)
let duration  = Float(15)
let frameRate = 15

Regift.createGIFFromSource(videoURL, startTime: startTime, duration: duration, frameRate: frameRate) { (result) in
    print("Gif saved to \(result)")
}

Acknowledgements

Thanks to Rob Mayoff's Gist, without which this library wouldn't exist.

My personal thanks to all of Regift’s contributors:

  • caughtinflux
  • samuelbeek
  • sebyddd
  • nakajijapan
  • dbburgess