LoginSignup
9
9

More than 5 years have passed since last update.

ImageMagick でアニメーション GIF を作る

Posted at

ImageMagick のコマンドでいろいろできることがわかったので、アニメーション GIF を作ってみた。google で検索して探した この画像 をローカルに origin.jpg という名前で保存し、アニメーション GIF にする。シェルは Zsh を使っている。

画像の情報を確認する

$ identify origin.jpg
origin.jpg JPEG 904x1024 904x1024+0+0 8-bit DirectClass 297KB 0.000u 0:00.000

画像を切り分ける

元画像は縦 3 コマ、横 4 コマの一枚の画像なので、コマごとに切り分ける。

$ for i in {0..2}; do
for> for j in {0..3}; do
for for> convert -crop 226x341+$(( 226*$j ))+$(( 341*$i )) origin.jpg out-$i-$j.jpg
for for> ;done
for> ;done

アニメーション GIF を作る

delay オプションでコマの間隔を指定する

$ convert -delay 15 out-*.jpg anime.gif
9
9
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
9
9