forked from unixpickle/Giraffe
-
Notifications
You must be signed in to change notification settings - Fork 1
mattfox12/Giraffe
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple GIF encoding class library for creating small animated GIF images. This encoder does not use LZW compression, but instead uses uncompressed GIFs by insert clear codes as needed, and forcing bytes to be nine bits. Added a palette class to create palette from an image (single at this point), which will reduce itself to 255 colors (if necessary) using a median-cut algorithm. Encode an animated gif of two partially transparent png images (matt1.png, matt2.png) as follows: // create Palette first UIImage *paletteImage = [UIImage imageNamed:@"Matt.png"]; ANPoint *mattePoint = [[ANPoint alloc] initWithR:255 withG:255 withB:255]; ANGifPalette *palette = [[ANGifPalette alloc] initWithImage:paletteImage.CGImage withMatte:mattePoint]; NSString *fileName = [NSString stringWithFormat:@"%@/Documents/matt_walk.gif", NSHomeDirectory()]; ANGifBitmap *bmp = [[ANGifBitmap alloc] initWithImage:[UIImage imageNamed:@"matt1.png"] withColorPalette:palette]; ANGifBitmap *bmp2 = [[ANGifBitmap alloc] initWithImage:[UIImage imageNamed:@"matt2.png"] withColorPalette:palette]; ANGifEncoder *enc = [[ANGifEncoder alloc] initWithFile:fileName withColorPalette:palette animated:YES]; // image creation [enc beginFile:bmp.size delayTime:0.5f]; [enc addImage:bmp]; [enc addImage:bmp2]; [enc endFile]; // release objects [enc release]; [bmp release]; [bmp2 release]; [mattePoint release]; [palette release]; [fileName release];
About
Encode animated GIF files on the iPhone
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Objective-C 87.5%
- C 12.5%