Skip to content

Easily convert a video to a GIF on iOS.

License

Notifications You must be signed in to change notification settings

michaelsabo/Regift

 
 

Repository files navigation

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





Requirements

  • Xcode 9+
  • Swfit 4.0+

Installation

Cocoapods

Regift is available through CocoaPods. 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

About

Easily convert a video to a GIF on iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 91.2%
  • Objective-C 4.9%
  • Ruby 3.9%