Skip to content

Instantly share code, notes, and snippets.

@tag1216
Created December 7, 2016 08:01
Show Gist options
  • Save tag1216/eb0103d9018ec087ca6ada6ffad676ed to your computer and use it in GitHub Desktop.
Save tag1216/eb0103d9018ec087ca6ada6ffad676ed to your computer and use it in GitHub Desktop.
ImageMagickで画像ファイル作成
#!/usr/bin/env bash
# 各画像フォーマットの作成
convert -size 100x100 xc:white -fill red -draw 'circle 50,50 25,25' 20161205_xxx_100x100.gif
convert 20161205_xxx_100x100.gif gif87:20161205_gif87a_100x100.gif
convert 20161205_xxx_100x100.gif 20161205_xxx_100x100.jpg
convert 20161205_xxx_100x100.gif 20161205_xxx_100x100.jpeg
convert 20161205_xxx_100x100.gif 20161205_xxx_100x100.png
# 透過画像
convert 20161205_xxx_100x100.gif -transparent white 20161205_trans_100x100.gif
convert 20161205_xxx_100x100.gif -transparent white 20161205_trans_100x100.png
convert -size 100x100 xc:white -channel alpha \
-fill '#ff000088' -draw 'circle 50,50 25,25' \
-fill '#00000000' -fuzz 5% -draw 'matte 1,1 floodfill' \
20161205_rgba_100x100.png
# リサイズ
convert 20161205_xxx_100x100.gif -resize 50x50 20161205_xxx_50x50.gif
convert 20161205_xxx_100x100.gif -resize 2000x2000 20161205_xxx_2000x2000.gif
# アニメーションGIF
mkdir tmp
convert -size 100x100 xc:white -fill red -draw 'circle 50,50 25,25' tmp/0.png
convert -size 100x100 xc:white -fill red -draw 'circle 50,50 10,10' tmp/1.png
convert -delay 50 -loop 0 tmp/*.png 20161205_anim_100x100.gif
rm -rf tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment