views:

28

answers:

0

I'm try to allow users to pull images out of their Photos collections using ALAssetsLibrary. Users can then upload these images. My goal is to allow users to upload any GIFs they may have in their library w/o loosing any animation they may have.

For PNG and JPEG files I can grab the ALAssetRepresentation, use - (CGImageRef)fullResolutionImage to get a CGImageRef, and then save it to NSData using UIImageJPEGRepresentation or UIImagePNGRepresentation.

However, because no similar function exists for GIF files, all I can do is covert the GIF to either JPEG or PNG, but then I lose the animation.

Is there either

  1. a way to grab the NSData straight from an ALAssetRepresentation object or

  2. a way to go from ALAssetRepresentation -> CGImageRef -> NSData without loosing any gif animation frames?

Thanks in advance!