GithubHelp home page GithubHelp logo

gifpro's Introduction

The ANGif Library

ANGif is a small class library that can be used to encode Graphics Interchange Format files using a simple interface. It could easily be ported to platforms other than Cocoa (e.g. UIKit/CocoaTouch). The ANGifEncoder class is the root of all GIF encoding, and can be used as follows:

ANGifEncoder * encoder = [[ANGifEncoder alloc] initWithOutputFile:@"myFile.gif" size:CGSizeMake(100, 100) globalColorTable:nil];
[encoder addApplicationExtension:[[ANGifNetscapeAppExtension alloc] init]];
[encoder addImageFrame:anImageFrame];
[encoder addImageFrame:anotherImageFrame];
[encoder closeFile];

The addImageFrame: method takes an instance of ANGifImageFrame, a basic class for enclosing images. The class itself can be instantiated using the initWithPixelSource:colorTable:delayTime: method. As of November 4th, 2011, the best color table to use is ANCutColorTable.

The ANGifImageFramePixelSource protocol is essential to the functionality of ANGif. It is suggested that you make a class that wraps a native image class such as NSBitmapImageRep, and implements all of the required methods.

The GifPro Project

The Xcode project included with this repository is GifPro, a Mac OS X demo of what ANGif is capable of. The project includes ANNSImageGifPixelSource, an NSBitmapImageRep wrapper that conforms to the ANGifImageFramePixelSource protocol. The ANExportWindow class includes most of the code that directly interfaces the ANGif library.

Contribute a Color Table

The GIF format works in a way such that files may only have 256 colors per image. This being said, algorithms exist to accurately calculate the best possible choices of colors for the 256-entry color table. The ANGif library is easily extendable to accomedate any color table algorithm that may be designed in the future.

If you are looking to implement a color table for ANGif, it is suggested that you have a look at the code for the ANColorTable base class. If you are still uncertain of exactly what you need to do to implement a color table, maybe have a look at ANCutColorTable. This was the first color table to be implemented for ANGif, and therefore should be a role model for those that follow.

gifpro's People

Contributors

unixpickle avatar teym avatar

Watchers

James Cloos avatar  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.