ibireme / YYImage

Image framework for iOS to display/encode/decode animated WebP, APNG, GIF, and more.
MIT License
1.77k stars 482 forks source link

关于webp的转码问题 #44

Open FutureChen opened 8 years ago

FutureChen commented 8 years ago
  由于我们项目中强制使用了FLAnimatedImage,所以我需要在下载图片完成以后,将图片转成NSData赋值给FLA在ImageView上显示出来。如下:

FLAnimatedImage *flImage = [FLAnimatedImage animatedImageWithGIFData:yyImage.animatedImageData]; self.animatedImage = flImage; 普通的gif这样操作完全没问题

这是我的图片地址: http://7xv1nd.com2.z0.glb.qiniucdn.com/942f4241967a4ec4a8567d6701c7a52f.gif?imageView2/2/h/375/w/750/format/webp

这是一张用七牛获取的webp 动图,我希望转成GIF的NSData复制给FLA,然而行不通,求大神解救

               YYImageDecoder *decoder=  [yyImage valueForKey:@"_decoder"];
                NSData *gifData=  [YYImageEncoder encodeImageWithDecoder:decoder type:YYImageTypeGIF quality:1.0];
                FLAnimatedImage *flImage = [FLAnimatedImage animatedImageWithGIFData:gifData];
                self.animatedImage = flImage;
FutureChen commented 8 years ago

PS :图片地址可以用谷歌浏览器打开

ibireme commented 8 years ago

检查了下,是个 Bug,通过内部 addImageWithData 来编码多帧 GIF 时失败。

Fixed: https://github.com/ibireme/YYImage/commit/dfe43e3e2ba4f44bef95e9d7ee330069f1f70639