简体   繁体   中英

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 = ?
}

Gif在iOS中不受支持,它将文件视为普通文件,并且也不会存储为UIImage而没有lib或其他内容,您可以使用dataWithContentsOfFile使其成为NSData

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM