Animated GIF in android

729 views
Skip to first unread message

Gully

unread,
Sep 17, 2013, 7:47:04 AM9/17/13
to kivy-...@googlegroups.com
Hi all,

I've just tried loading an animated gif into an Image widget running on android - the whole app gets stuck right after logging "loading yyyy.gif". When run on windows - it obviously works perfectly.

Any ideas?

Thanks!

Ben Rousch

unread,
Sep 17, 2013, 7:57:46 AM9/17/13
to kivy-...@googlegroups.com
It looks like animated gifs on Android is a very old and annoying problem even today (https://code.google.com/p/android/issues/detail?id=3422).

There is probably a better solution, but you could extract each frame from the gif and simulate the animation using Kivy canvas and Clock events to cycle through the frames.


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
 Ben Rousch
   bro...@gmail.com
   http://clusterbleep.net/

Akshay Arora

unread,
Sep 17, 2013, 12:41:07 PM9/17/13
to kivy-...@googlegroups.com
I'd make sure you have pil setup as a dep while building your apk. by default gif uses a pure python loader if pil isn't found.
The pure python loader is extremely slow for android. Maybe we should move it to cython, however there is a better solution. Just include pil.

Gully

unread,
Sep 17, 2013, 3:16:41 PM9/17/13
to kivy-...@googlegroups.com
Yup, that's it :) - I just found out it does work, but takes a loooong time :)
Strange, since I do have PIL in my dependencies - I'll make sure it's loaded...

Thanks!

Akshay Arora

unread,
Sep 17, 2013, 4:10:25 PM9/17/13
to kivy-...@googlegroups.com
btw gifs are finicky, even with pil you could see many artifacts(pure python loader might be a bit better but it's unbearably slow). There is a workaround, just add multiple images inside a .zip and set the Image's source to that zip. kivy will automatically animate the Images like a .gif in the order of their file names. For a example of animation using sequenced images like these take a look at the sequenced_images example.

Willem Dodds

unread,
Feb 22, 2017, 7:33:38 AM2/22/17
to Kivy users support
So you say put it in a zip and it will animate. However will it go through them once and stop on the final frame/ How can one change the settings of how this is animated, so that it goes through the sequence of say 1-4 images and stops and stays on the final fourth one?
Reply all
Reply to author
Forward
0 new messages