facebook / fresco

An Android library for managing images and the memory they use.
https://frescolib.org/
MIT License
17.07k stars 3.75k forks source link

Animations with PNG sequences #462

Closed haseebrabbani closed 7 years ago

haseebrabbani commented 9 years ago

Hi, I am trying to determine the viability of Fresco for the animations in my app. I have PNG sequences for each animation which are included as drawable resources in my project (one PNG per frame named as frame_1.png, frame_2.png, etc...). My question is: how can I get Fresco to animate these frames for me in a SimpleDraweeView? Does it currently support this functionality?

michalgr commented 9 years ago

Is transforming sequence of pngs into single animated webp image an option here ? Note that you would probably save a lot of bytes this way. There is no support for assembing animations from multiple frames right now.

haseebrabbani commented 9 years ago

Is there a recommended tool for converting PNG sequences into animated WebP files?

AcidicSkittles commented 9 years ago

The only tool that comes to mind is ImageMagick. You'll have to convert the frames to an animation (gif or webp) before sending it to your app. I don't know if it's possible to use ImageMagick to convert the png frames to an animation in android

haseebrabbani commented 9 years ago

So I've got the GIF animation. How can I tell Fresco to only play it once? I see the anim.start()/stop() methods, but is there a way to tell Fresco to just play an animation once and then stop?

AcidicSkittles commented 9 years ago

I don't think there's an api call in frasco for that. If you're using ImageMagick to build the gif, I do know that it has a -loop flag. You can try that to set it to play only once using -loop 1

solohsu commented 9 years ago

It seems like GifImage#getLoopCount is never used to limit the loop times...

plamenko commented 9 years ago

The loop count specified in the GIF image should be respected. If that's not the case then it is a bug.

tyronen commented 8 years ago

The bug is tracked separately in #180

erikandre commented 7 years ago

Cleaning up old issues