Convert Gif image to NSData
I have a gif image in my photo album. When I use the UIImagePickerController to select that image, I need to convert the image to NSData for storing. Earlier, I used NSData *thumbData = UIImageJPEGRepresentation(thumbnail, 0.5); but it will not work with gif images. thumbData will be nil. How can I get NSData from the gif image? How can I know that it is a gif image that needs special handing? The key here is to save the GIF file or URL download directly into a NSData instead of making it a UIImage. Bypassing UIImage will let the GIF file keep the animation. Here is some code to convert a GIF