From the title you guessed that in this post we will:
- show the code to transform png files to gif (animated gif)
- show a practical example to make the png for the animation with Powepoint
So the procedure is this:
- open powerpoint
- create different slides with one frame for slide
- save the powerpoint as png files for every slide (save as… watch the video)
- run the code below saved in the folder with the png just saved
Let’s go to watch the video to see exactly what do I mean.
Show the code to make animated gif
Here is the code
from PIL import Image import glob # Create the frames frames = [] imgs = glob.glob("*.png") for i in imgs: new_frame = Image.open(i) frames.append(new_frame) # Save into a GIF file that loops forever frames[0].save('png_to_gif.gif', format='GIF', append_images=frames[1:], save_all=True, duration=300, loop=0)
As I already wrote aboce, put the file saved as pnggif.py (for example) in the folder where the png files are and run the file. To run the file you can go in the address bar click on it (on the right side) and write cmd. When the cmd opens, write: python pnggif.py (or whatever you called the file and the game is done).