speed up loading of animated gif kivy speed up loading of animated gif kivy python-3.x python-3.x

speed up loading of animated gif kivy


I believe this may help you, I had a series of png files that I wanted to animate into an explosion, and this was a game where the explosions were constant. Initially, every time the animation took place, the game stalled and stuttered horribly. This is what I did to get my game to run smoothly. I zipped the png files, and used the following code to preload them, which I placed in the __init__ method of the Screen widget that the images appeared on.

load_zipped_png_files = Image(    source = 'explosion.zip',     anim_delay = 0,    allow_stretch = True,     keep_ratio = False,    keep_data = True)

I believe the keep_data option allows for the preloading of the images( into a cache I imagine ), which saves the program from having to reload them every time they are used.

Now it could be that I am mistaken about the role keep_data is playing here ( and if someone reading this knows better, please do correct me ), but zipping the files and using them in this way definitely made the animations acceptably smooth. You could test it with and without keep_data = True and figure it out yourself.


For me it simply worked as i needed to gifs extension images:

Image(source= 'image.gif', anim_delay= 0,mipmap= True,allow_stretch= True)

It was added mipmap, so that enhances the textures using OpenGL.