hlily
hlily

Reputation: 13

How to convert UIImage to NSData when the image's type is gif?

I've searched for so much articles about converting UIImage to NSData.There are some solutions.But when I only know the (UIImage*) image object , how could I configure it's NSData correctly especially when it's type is gif.

-(void)convertUIImageToNSData:(UIImage* )image{
    //if the image's type is gif,how to get it's data
    NSData *data = ?
}

Upvotes: 0

Views: 657

Answers (2)

hlily
hlily

Reputation: 13

Finally, I got the nsdata of an image by pass the original data when I just pick an picture from system album. That's little not so elegant.

Upvotes: 0

Tj3n
Tj3n

Reputation: 9943

Gif is not supported in ios, it will treat the file as a normal file and also wont be store as UIImage without lib or something, you can just use dataWithContentsOfFile it to make it become NSData

Upvotes: 1

Related Questions