koush / ion

Android Asynchronous Networking and Image Loading
Other
6.29k stars 1.03k forks source link

Gif distortion issue #760

Open darshan1689 opened 8 years ago

darshan1689 commented 8 years ago

I have problem in displaying some gif images with ion library.The images are distorted while loading with ion image loading library.These images are working well with fresco and glide.Please help Below are some example:

screenshot_2016-08-20-13-03-03 screenshot_2016-08-20-13-03-36 screenshot_2016-08-20-13-08-08 screenshot_2016-08-20-13-08-12 screenshot_2016-08-20-13-08-17 screenshot_2016-08-20-13-52-28 screenshot_2016-08-20-13-52-33 screenshot_2016-08-20-13-53-00

Original images:

http://ntechnosoft.com/2016/Projects/lulzee/images/gallery_img/2gl_images0607201604139292.gif http://ntechnosoft.com/2016/Projects/lulzee/images/gallery_img/2gl_images1407201604224842.gif http://ntechnosoft.com/2016/Projects/lulzee/images/gallery_img/4gl_images140720160422185.gif

davebren commented 8 years ago

Can confirm this is also happening for me, with https://media.giphy.com/media/ykzXbY24BFqY8/giphy.gif

davebren commented 8 years ago

@koush Any idea where this could be coming from, or where to start looking? Could it be all the way down in the decoder?

koush commented 8 years ago

I've seen this before. Last time I looked I wasn't too versed in the GIF spec, so I wasn't entirely sure what was wrong. Have written a GIF encoder since, so I have a better idea. For that type of artifacting, it's an issue with either gif disposal code and/or gif palette transparent index. It's definitely down in the decoder.

davebren commented 8 years ago

@koush ☝️The pull request above fixes: http://ntechnosoft.com/2016/Projects/lulzee/images/gallery_img/2gl_images0607201604139292.gif http://ntechnosoft.com/2016/Projects/lulzee/images/gallery_img/4gl_images140720160422185.gif https://media.giphy.com/media/ykzXbY24BFqY8/giphy.gif

but not: http://ntechnosoft.com/2016/Projects/lulzee/images/gallery_img/2gl_images1407201604224842.gif

So I think the artifacting there might be caused by a different decoding issue. I haven't found any gifs that break with the fix for the rest though.

koush commented 8 years ago

@eskimoapps holy crap you are awesome, thanks!

davebren commented 8 years ago

No problem! We are looking to get gif support into production soon, so I'll probably start looking at the other artifacting bug when I get the chance. I also have some other things like a View wrapper for pausing & unpausing, rounding the corners, and auto-scaling once the file is downloaded.