0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GIFの作成

Posted at

コード

durationの単位はmsで、このコード内だと1秒の間隔でアニメションが実行されます。loopはアニメーションが何回再生させるかを指定します。loopに「0」を指定すると無限再生となります。

gifcreate.py
from PIL import Image

# open first image
img1 = Image.open("kick1.png")
# open second image
img2 = Image.open("kick2.png")
# open third image
img3 = Image.open("kick3.png")

# generate gif
img1.save("kick.gif",format="GIF",append_images=[img2,img3],save_all=True,duration=1000,loop=0)

使用した画像

kick1.png
kick1.png
kick2.png
kick2.png
kick3.png
kick3.png

実行結果

上記のコードを実行するとこのようなGIFを作れます。
kick.gif

durationを100msにしたら下記のようにアニメーションが早くなります。
kick.gif

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?