Coder Social home page Coder Social logo

nsgif's Introduction

NSGIF

NSGIF is an iOS Library for converting your videos into beautiful animated GIFs. Check out this example.

Sometimes we need to deal with GIFs in Cocoa. This can really be a pain in the ass (believe me). And here comes our hero :octocat:. Breaking through errors and glitches and generating smooth GIFs ๐Ÿ’จ.

How it works

NSGIF That's it really. Although iOS defaults to .MOV for recordings you can also use .AVI and .MP4. If you want to go into some technical details though, here they are:

Add to your project

There are 2 ways you can add NSGIF to your project:

Manual installation

Simply import the 'NSGIF' into your project then import the following in the class you want to use it:

      #import "NSGIF.h"

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like NSGIF in your projects. See the "Getting Started" guide for more information.

Podfile

        platform :ios, '7.0'
        pod "NSGIF", "~> "1.0"

Practical use

[NSGIF createGIFfromURL:url withFrameCount:30 delayTime:.010 loopCount:0 completion:^(NSURL *GifURL) {
	NSLog(@"Finished generating GIF: %@", GifURL);
}];

The library is lightweight and very straight forward. Once you grab the URL of your video, pass it to NSGIF alongside the frame count, delay time and loop count. Let me explain those for you:

	frameCount - is the amount of frames of the GIF. You can adjust this depending on the resolution of your video. The higher the resolution the lower to frame count!
    delayTime  -  is the amount of time for each frame in the GIF.
    loopCount  - is the number of times the GIF will repeat. Defaults to 0, which means repeat infinitely.

I recommend you to play with those values and find the best ones for your video.

Demo

Check out the demo project for a quick example of how NSGIF works. After you capture your video, this is what you have to do, to retrieve the GIF:

NSGIF

Todo

  • Add MacOS Demo
  • Auto-calculate the frame count
  • Show preview of GIF in iOS App
  • Create GIFs based on enums for quality type

Pull requests are more than welcomed!

License

Usage is provided under the MIT License. See LICENSE for the full details.

nsgif's People

Contributors

sebyddd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.