I have been trying to convert an image to a .gif file contained in an NSData instance, but iOS provides only 2 methods for image format output:
UIImagePNGRepresentation
UIImageJPEGRepresentation
returning PNG files and JPEG files respectively as NSData
. Is there any API or way to get NSData
for .gif files?
I do not have a path or a URL for a file. It is a UIImage which I get after a call to my app's core. Soo, the below code will not work for my scenario.
NSString *pathForGif = [[NSBundle mainBundle] pathForResource: @"gifFile" ofType: @"gif"];
NSData *gifData = [NSData dataWithContentsOfFile: pathForGif];
NSLog(@"Data: %@", gifData);
Is there any way to output a .gif file from a UIImage?