There are many apps for making GIF animations, but since I have ** Pythonista3 **, I decided to make it myself while referring to the articles of many seniors.
I had made a GIF animation with ** Python ** on ** Win10 ** before, so I wrote it with ** PIL ** based on that memory, but only the first image is saved. Was not done.
testGIF.py
w,h = 100,100
images = []
for c in range(0,256,8):
img = Image.new('RGB',(w,h),(c,c,c))
images.append(img)
images += reversed(images)
SaveName = 'test.gif'
images[0].save(SaveName,
save_all=True,
append_images=images[1:],
optimize=False,
duration=20,
loop=0)
I did a lot of research, but in the end I was able to confirm the operation on win10, so I concluded that ** PIL on iOS does not work **.
While researching, I had a similar question and found out about the existence of "images2gif". It's a module name that is exactly what I wanted to do.
It was also featured in the official documentation and was installed from the beginning.
-Pythonista Module — Python 3.6.1 Documentation
Basically, the following description seems to be fine.
writeGif( SaveName, ImageList, duration=0.1,repeat=True)
testGIF2.py
from PIL import Image
from images2gif import writeGif
w,h = 100,100
images = []
for c in range(0,256,8):
img = Image.new('RGB',(w,h),(c,c,c))
images.append(img)
images += reversed(images)
SaveName = 'test.gif'
writeGif( SaveName, images, duration=0.02,repeat=True)
The last thing that surprised me was that the Japanese help article I was looking for was ** "I posted it myself before" **, and I thought it was finally dangerous.
Recommended Posts