Sunday, April 15, 2007

ImageMagickで左上と右下が角丸の四角を描画する

ImageMagickで左上と右下が角丸の四角を描画するには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.3-Q16
rem M moveto(x, y)
rem L lineto(x, y)
rem A elliptical arc(rx ry x-axis-rotation large-arc-flag sweep-flag x y)+
rem 単色
%im%\convert.exe -size 100x100 xc:none -fill #BBDDFF -draw "path 'M 0,10 A 10,10 0 0,1 10,0 L 99,0 L99,90 A 10,10 0 0,1 90,99 L 0,99 Z" sample140a.png

出力画像(sample140a.png)


rem グラデーション
%im%\convert.exe -size 100x100 xc:none -tile gradient:#BBDDFF-#E0F0FF -draw "path 'M 0,10 A 10,10 0 0,1 10,0 L 99,0 L99,90 A 10,10 0 0,1 90,99 L 0,99 Z" sample140b.png

出力画像(sample140b.png)


rem 切り取り
%im%\convert.exe -size 100x100 xc:none -channel RGBA -fill #ffffffff -draw "path 'M 0,10 A 10,10 0 0,1 10,0 L 99,0 L99,90 A 10,10 0 0,1 90,99 L 0,99 Z" sample2bg.jpg -compose src_in -composite sample140c.png

元画像(sample2bg.jpg)


出力画像(sample140c.png)

No comments: