Fresco: Animated Gif loading performance

Created on 30 Oct 2015  路  9Comments  路  Source: facebook/fresco

Disclaimer: I don't have good understanding of how current GIF loading works in Fresco code, only base on the symptom of taking long time to load multiple 4MB GIF generated by Google Photo. also sympton of a frequent refresh of a listview with fresco animated GIF.

If user choose to load animated GIF without auto play (setAutoPlayAnimations=false), may be good idea to not decode the GIF (for example, a 4MB GIF generated by Google Photo could take long time to decode, and it is a waste to only display it as static image), instead it may be good idea, Fresco should cache and load its thumbnail, if thumbnail doesn't exist, it may decode the 4MB GIF for the first time, then generate thumbnail then cache thumbnail for future display.

For app with setAutoPlayAnimations=true, it would be good ideal to have parameters to allow initial pause period(developers could give it millisecond or few seconds) to allow animated GIF to display as static thumbnail image, and only play the GIF after it is fully loaded and pass the pause period.
Example: a listview contain a downloaded animated GIF and also contain a downloading GIF with download progress bar, app need to auto play the first downloaded GIF, and keep refresh listview every second in order to keep download progressbar updated, if auto play animated GIF could have initial pause period (let's say 1.5 second), then it will prevent constantly reloading of animated GIF.

Hope it make sense.

enhancement

Most helpful comment

We're looking into the current GIF implementation to see what can be improved. However, large GIFs are time- and memory consuming to decode and display.

All 9 comments

Thank you for your suggestion. We're always testing new ways to optimize the load and rendering of the images. Anyway, if you give us the reference to the specific image we can investigate more on the reason of the performance you're measuring.
Thanks

I agree with this feature request, you can even see this problem in FB Messenger for Android :) Send five or so gifs to somebody, then scroll up and down so that the gifs go on and off screen.

See this repo for a repro case using removeClippedSubviews in React Native: https://github.com/brentvatne/gif-removeClippedSubviews -- notice that when you scroll so that the image is out of view then scroll back, there is a blank spot where the image should be for some time. This should instead show a thumbnail, as @mingqlin suggested. cc @massimocarli

I encountered the same problen,i load a lot of gifs and choose to not play it automatically.When i scroll the list, The gif is very slow to load. So i choose to decode the gif and get the first frame of it as a bitmap, but i have no idea how to use Fresco to load a bitmap.

I'm also facing the same issue when loading images from imgur in a recyclerview, gif takes a very long time to load. I used this hack to load the prefetch images: _https://viksaaskool.wordpress.com/2015/08/30/how-to-do-userless-reddit-oauth-2-on-android-with-retrofit-tutorial/_

but still GIF is loading very slow

when we set to setAutoPlayAnimations=false , what actually happening ?

any news? updates?

We're looking into the current GIF implementation to see what can be improved. However, large GIFs are time- and memory consuming to decode and display.

Since the last update we have launched improved gif support that should help with performance issues. Please re-test on the latest build and reopen the ticket if the performance is still an issue. Thanks!

I am creating react native app and load a 3.7MB gif. It is working fine with device with more than 4GB ram, but it is slow on 4GB ram device, and very slow on 3GB ram device and lower. Is there any plan to have more improvement on this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephen-workpop picture stephen-workpop  路  4Comments

stevenmtang picture stevenmtang  路  3Comments

ykostova picture ykostova  路  3Comments

bigfreeZhou picture bigfreeZhou  路  4Comments

eldk picture eldk  路  3Comments