Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying animated GIFs with Python #626

Closed
onionsTasteGood opened this issue May 24, 2018 · 2 comments
Closed

Displaying animated GIFs with Python #626

onionsTasteGood opened this issue May 24, 2018 · 2 comments

Comments

@onionsTasteGood
Copy link

Unlike C++, when displaying an animated GIF with Python, the image displays but only the first frame. Does this library provide a solution for this or should I look to add this functionality to the code myself? If so, what would be the best way to do this? Through GraphicsMagick maybe? Any hints would be greatly appreciated.

I took a look at a previous issue, but it's two years old, and I thought maybe there's a solution now.

Thanks!

@hzeller
Copy link
Owner

hzeller commented May 24, 2018

From the library usage point of view, you essentially want to create an offscreen canvas, and then swap images and send one at a time. and use the off-time to fill the next image and swap. Have a look at the examples of how to use the SwapOnVSync().
If you only have a few images in the gif, it might be useful to preprocess all of them into their own offscreen canvas and in the main loop then just swap these in one at a time - the CPUs are often overwhelmed to do the online processing, so preprocessing images will help a lot. In particular if you use Python.

@hzeller hzeller closed this as completed Aug 2, 2018
@Simon-Ince
Copy link

I got this working, I've posted my .py in a Gist here if it helps anyone: https://gist.github.com/Simon-Ince/910c440eb34bb722afa90853ecfb1d85

It needs some tweaking, gifs have timings for each of thier frames and I haven't taken this into consideration.

hzeller added a commit that referenced this issue Mar 18, 2020
… on loaded system.

This used to be a compile-time option FIXED_FRAME_MICROSECONDS but
it is very useful to tweak at runtime.

Issues #276 #458 #467 #478 #483 #495 #551 #556 #571 #626 #651 #710
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants