This is a mini project that creates a GIF of a dancing cat using Python.
- I used
PIL.Imageto resize all images to (300, 300). Without this, the code raises aValueError('all input arrays must have the same shape'). - The list of filenames is written so the GIF loops the cat dancing from right to left and back.
imageio.v3is used to save the GIF with a frame duration of 0.25s and infinite looping.
- Install dependencies:
pip install pillow imageio - Make sure the
images/folder containsimage_1.jpgtoimage_4.jpg. - Run: python create_gif.py
- The GIF will be saved as
dancing_cat.gif. - You can replace the images with your own as long as they have the same dimensions.
Thanks to @codedex-io and @sonnynomnom for the original tutorial!
Their profiles:
Codedex-io
Sonny Li
