Skip to content

maxfong/AnimatedGIFImageSerialization

 
 

Repository files navigation

AnimatedGIFImageSerialization

AnimatedGIFImageSerialization decodes an UIImage from Animated GIFs image data, following the API conventions of Foundation's NSJSONSerialization class.

As it ships with iOS, UIImage does not support decoding animated gifs into an animated UIImage. But so long as ANIMATED_GIF_NO_UIIMAGE_INITIALIZER_SWIZZLING is not #define'd, the this library will swizzle the UIImage initializers to automatically support animated GIFs.

Usage

Decoding

UIImageView *imageView = ...;
imageView.image = [UIImage imageNamed:@"animated.gif"];

Animated GIF

Encoding

UIImage *image = ...;
NSData *data = [AnimatedGIFImageSerialization animatedGIFDataWithImage:image
                                                              duration:1.0
                                                             loopCount:1
                                                                 error:nil];

Contact

Mattt Thompson

License

AnimatedGIFImageSerialization is available under the MIT license. See the LICENSE file for more info.

About

Complete Animated GIF Support for iOS, with Functions, NSJSONSerialization-style Class, and (Optional) UIImage Swizzling

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 96.8%
  • Ruby 3.2%