10

I'm trying to open and run an animated gif on my pygame display. i have spent quite a few hours searching for an solution for this but i have not came across one yet.

thank you in advanced for you help!

random soup dog
  • 159
  • 1
  • 1
  • 8
  • This question is actually duplicate: [How can I load an animated GIF and get all of the individual frames in Pygame?](https://stackoverflow.com/questions/29571399/how-can-i-load-an-animated-gif-and-get-all-of-the-individual-frames-in-pygame) – Rabbid76 Oct 03 '20 at 09:07

2 Answers2

7

Documentation clearly states that GIF's wont be animated. However, you could dissect the GIF into frames, or sprites or still images in that matter, and animate them yourself. You can find free tools that can generate those frames.

mehmetminanc
  • 1,359
  • 9
  • 14
1

Pygame doesn't support animated GIFs natively, and you'd need GIFImage for that. But probably the author deleted it.

You could use a spritesheet or separate images for your sprite frames. Here a tutorial for Sprites.

You could fix that problem simply, to get animation you have to do break up your images after then load them using by pygame.image.load() and in your main game logic, run that pictures. It will be an animation as a GIF image, except it's a little bit long process because you have to seperate frames. Also don't forget to use Sprites.

For seperate images: GIMP Amazingly simple to use it.