Sunday, July 15, 2007

ImageMagickで青色っぽい部分を透過させる

ImageMagickで青色っぽい部分を透過させるには、以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16

rem 青色っぽい部分を透明に設定して透過PNG作成
%im%\convert.exe tree1.jpg -channel A -fx "(hue>0.47&&hue<0.69&&luminosity>0.5)?0:1" sample180a.png

rem グラデーションと透過PNGの重ね合わせ
%im%\convert.exe -size 300x225 gradient:#80ffff-#e0ff80 sample180a.png -composite sample180b.jpg

元画像(tree1.jpg)


透過PNG(sample180a.png)


グラデーションと重ね合わせた出力画像(sample180b.jpg)


2008/01/04追記
ver6.3.7では、以下のバッチファイルのように-matteを追加します。
rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.7-Q16
%im%\convert.exe tree1.jpg -matte -channel A -fx "(hue>0.47&&hue<0.69&&luminosity>0.5)?0:1" sample180a.png
%im%\convert.exe -size 300x225 gradient:#80ffff-#e0ff80 sample180a.png -composite sample180b.jpg

2008/07/13追記
ver6.4.0あたりからluminosityからlightnessに変わったので、以下のバッチを実行します。
rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.4.2-Q16

%im%\convert.exe tree1.jpg -matte -channel A -fx "(hue>0.47&&hue<0.69&&lightness>0.5)?0:1" sample180a.png

%im%\convert.exe -size 300x225 gradient:#80ffff-#e0ff80 sample180a.png -composite sample180b.jpg

Wednesday, July 11, 2007

ImageMagickでナビゲーション風に画像を重ね合わせる

ImageMagickでナビゲーション風に画像を重ね合わせるには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16

%im%\convert.exe sample2bg.jpg -extent 180x100 ( sample3b.jpg -channel A -fx "(j<h/2)&&(i<j*20*2/h)?0:p" -fx "(j>=h/2)&&(i<(20-(j-h/2)*20*2/h))?0:p" -fx "(j<h/2)&&(i>80+j*20*2/h)?0:p" -fx "(j>=h/2)&&(i>(100-(j-h/2)*20*2/h))?0:p" ) -geometry +80+0 -composite sample179a.jpg

元画像(sample2bg.jpg)


元画像(sample3b.jpg)


出力画像(sample179a.jpg)


Sunday, July 08, 2007

ImageMagickで斜線画像を生成する

ImageMagickで斜線画像を生成するには、以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
%im%\convert.exe -size 100x100 xc:none -fx "((200+j-i)%%10<7)?#7090E0:#fbfaf7" sample178a.jpg
%im%\convert.exe -size 100x100 xc:none -fx "((i+j)%%20<6)?#C0B49D:#fbfaf7" sample178b.jpg

出力画像(sample178a.jpg)


出力画像(sample178b.jpg)



関連項目
ImageMagickで任意の大きさの市松模様を作成する
ImageMagickで任意の大きさの斜め四角模様を作成する
ImageMagickで、画像に半透明の斜線を重ね合わせる

Saturday, July 07, 2007

ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる - その3

ImageMagickで境界を半円状の半透明グラデーションにして2つの画像を重ね合わせるには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
%im%\convert.exe sample2bg.jpg -extent 170x100 ( sample3b.jpg -channel A -fx "i<((1-sin(pi*j/h))*10)?0:1" -fx "(((1-sin(pi*j/h))*10)<=i)&&(i<((1-sin(pi*j/h))*10+20))?(i-((1-sin(pi*j/h))*10))/20:p" ) -geometry +70+0 -composite sample177a.jpg

元画像(sample2bg.jpg)


元画像(sample3b.jpg)


出力画像(sample177a.jpg)


2008/01/04追記
Ver6.3.7では、以下のバッチファイルのように-matteを追加します。
rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.7-Q16
%im%\convert.exe sample2bg.jpg -extent 170x100 ( sample3b.jpg -matte -channel A -fx "i<((1-sin(pi*j/h))*10)?0:1" -fx "(((1-sin(pi*j/h))*10)<=i)&&(i<((1-sin(pi*j/h))*10+20))?(i-((1-sin(pi*j/h))*10))/20:p" ) -geometry +70+0 -composite sample177a.jpg

関連項目
ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる
ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる - その2
ImageMagickとPHPで、2つの画像を連結する

Friday, July 06, 2007

ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる - その2

ImageMagickで斜めの境界を半透明グラデーションにして2つの画像を重ね合わせるには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
%im%\convert.exe sample2bg.jpg -extent 180x100 ( sample3b.jpg -channel A
-fx "i<(10-10*j/h)?0:1" -fx "((10-10*j/h)<=i)&&(i<(20-10*j/h))?(i-(10-10*j/h))/10:p" ) -geometry +80+0 -composite sample176a.jpg


元画像(sample2bg.jpg)


元画像(sample3b.jpg)


出力画像(sample176a.jpg)

2008/01/04追記
Ver6.3.7では、以下のバッチファイルのように-matteを追加します。
rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.7-Q16
%im%\convert.exe sample2bg.jpg -extent 180x100 ( sample3b.jpg -matte -channel A
-fx "i<(10-10*j/h)?0:1" -fx "((10-10*j/h)<=i)&&(i<(20-10*j/h))?(i-(10-10*j/h))/10:p" ) -geometry +80+0 -composite sample176a.jpg

関連項目
ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる
ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる - その3
ImageMagickで、2つの画像が交互にスクロールするアニメーションGIFを作成する
ImageMagickとPHPで、2つの画像を連結する

Thursday, July 05, 2007

ImageMagickで上部がカーブしたタブ画像を作成する

ImageMagickで上部がカーブしたタブ画像を作成するには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
rem タブ画像1 - 非選択
%im%\convert.exe -size 100x10 gradient:#f4f4f4-#cccccc ( -size 100x20 xc:#cccccc ) -append -background none -wave -4x200 -gravity north -crop 100x25+0+0 +repage -extent 102x25 -gravity center -fill #707070 -pointsize 15 -font "c:/winnt/fonts/msmincho.ttc" -draw @lbl.txt sample172a.gif
rem タブ画像1 - 選択
%im%\convert.exe -size 100x10 gradient:#ffffdd-#f8c749 ( -size 100x20 xc:#f8c749 ) -append -background none -wave -4x200 -gravity north -crop 100x25+0+0 +repage -extent 102x25 -gravity center -fill #8c8769 -pointsize 15 -font "c:/winnt/fonts/msmincho.ttc" -draw @lbl.txt sample172b.gif
rem タブ画像1 - hover
%im%\convert.exe -size 100x10 gradient:#ffffdd-#fce769 ( -size 100x20 xc:#fce769 ) -append -background none -wave -4x200 -gravity north -crop 100x25+0+0 +repage -extent 102x25 -gravity center -fill #f29719 -pointsize 15 -font "c:/winnt/fonts/msmincho.ttc" -draw @lbl.txt sample172c.gif
rem 3つのボタン画像を連結
%im%\convert.exe sample172a.gif sample172b.gif sample172c.gif +append tab1.gif

lbl.txtには、以下の内容をUTF-8で保存します。
text 0,2 '詳細設定'

出力画像(tab1.gif)

Friday, June 22, 2007

ImageMagickで透過タブ画像を作成する

ImageMagickで透過タブ画像を作成するには、以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16

rem 元画像から下部分を切り出し
%im%\convert.exe sample10.jpg -gravity southwest -crop 300x20+0+0 +repage bar.png

rem タブ画像1 - 非選択
%im%\convert.exe -size 300x30 xc:none -stroke none -draw "fill #000000 font-size 12 text 32,16 'Home' fill #ffffff font-size 12 text 30,14 'Home'" ( +clone -background #000000 -shadow 40x2+3+3 ) +swap -background none -mosaic +tile -gravity northwest -crop 108x20+0+0 bar.png -insert 0 -composite -crop 108x20+0+0 +repage sample125a.gif
rem タブ画像1 - 選択
%im%\convert.exe -size 300x30 xc:none -tile gradient:#bbddff-#f0f5ff -stroke #ffffff -draw "roundrectangle 0,0 99,29 8,8" +tile -stroke none -fill #3070a0 -draw "font-size 12 text 32,15 'Home'" ( +clone -background #000000 -shadow 40x2+3+3 ) +swap -background none -mosaic +tile -gravity northwest -crop 108x20+0+0 bar.png -insert 0 -composite -crop 108x20+0+0 +repage sample125b.gif
rem 透過タブ画像1 - hover
%im%\convert.exe -size 300x30 xc:none -fill #808080 -stroke #ffffff -draw "opacity 0.5 roundrectangle 0,0 99,29 8,8" +tile -stroke none -draw "fill #000000 font-size 12 text 32,16 'Home' fill #ffffff font-size 12 text 30,14 'Home'" ( +clone -background #000000 -shadow 40x2+3+3 ) +swap -background none -mosaic +tile -gravity northwest -crop 108x20+0+0 bar.png -insert 0 -composite -crop 108x20+0+0 +repage sample125c.gif
rem 3つの状態のタブ画像を連結
%im%\convert.exe sample125a.gif sample125b.gif sample125c.gif +append tab1.gif

背景画像(sample10.jpg)


出力画像(tab1,gif)

Saturday, June 16, 2007

ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる

ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせるには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
rem 10ピクセルだけ重ねる
%im%\convert.exe sample2bg.jpg -extent 190x100 ( sample3b.jpg -channel A -fx "i<10?i/10:1" ) -geometry +90+0 -composite sample175b.jpg

元画像(sample2bg.jpg)


元画像(sample3b.jpg)


出力画像(sample175b.jpg)


2008/01/04追記
Ver6.3.7では、以下のバッチファイルのように-matteを追加します。
rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.7-Q16
rem 10ピクセルだけ重ねる
%im%\convert.exe sample2bg.jpg -extent 190x100 ( sample3b.jpg -matte -channel A -fx "i<10?i/10:1" ) -geometry +90+0 -composite sample175b.jpg

関連項目
ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる - その2
ImageMagickで境界を半透明グラデーションにして2つの画像を重ね合わせる - その3
ImageMagickとPHPで、2つの画像を連結する


Friday, June 15, 2007

ImageMagickでグラデーションのかかった同心円の模様を描画する

ImageMagickでグラデーションのかかった同心円の模様を描画するには、
以下のバッチを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16

rem 白黒
%im%\convert.exe -size 150x150 xc:white -fx "(cos(sqrt(pow(75-i,2)+pow(75-j,2))/3)+1)/2*0.4+0.6" sample174a.png
rem 2色
%im%\convert.exe -size 150x150 xc:white ( xc:#20c332 xc:#ffff10 +append -resize 2x1 ) -fx "v.p{cos(sqrt(pow(50-i,2)+pow(100-j,2))/7)+1)/2*0.4+0.6,1}" sample174b.jpg

出力画像(sample174a.png)


出力画像(sample174b.jpg)

Tuesday, June 12, 2007

ImageMagickで文字列の中央をへこませる

ImageMagickで文字列の中央をへこませるには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16

%im%\convert.exe -pointsize 50 -fill #bbddff -font Tahoma label:ImageMagick -virtual-pixel background -background white -fx "p{i,(j-sin(pi*i/w)*0.8*h/2)/(1-sin(pi*i/w)*0.8)}" sample171.jpg

出力画像(sample171.jpg)


関連項目
ImageMagickで文字列の端を絞り込む

Friday, June 08, 2007

ImageMagickで鏡面映り込みを作成する - その4

ImageMagickで鏡面映り込みを作成するには、以下のバッチを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
rem 右側を若干暗くなるようにグラデーション適用
%im%\convert.exe sample4.jpg -fx "p*(1-i/(w*4))" -bordercolor #c0c0c0 -border 1x1 -channel RGBA sample4t.png
rem 反転&グラデーションをかけて
%im%\convert.exe sample4t.png -fx "p*j/h*0.8" -flip sample4t2.png
rem 縦に連結+台形変形+傾け
%im%\convert.exe sample4t.png sample4t2.png -append -virtual-pixel background -background black -fx "p{i*1.1,(j*w-i*h*0.05)/(w-i*0.1)}" -background none -shear 0x350 -gravity center -extent 220x220 sample170a.jpg

元画像(sample4.jpg)


出力画像(sample170a.jpg)

ImageMagickで画像を丸型に切り取って点線が回転するGIFアニメーションを作成する

ImageMagickで画像を丸型に切り取って点線が回転するGIFアニメーションを作成するには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
%im%\convert.exe -size 100x100 xc:none -fill white -draw "circle 50,50 50,2" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 7 circle 50,50 50,3" f1.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "circle 50,50 50,2" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 6 circle 50,50 50,3" f2.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "circle 50,50 50,2" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 5 circle 50,50 50,3" f3.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "circle 50,50 50,2" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 4 circle 50,50 50,3" f4.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "circle 50,50 50,2" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 3 circle 50,50 50,3" f5.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "circle 50,50 50,2" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 2 circle 50,50 50,3" f6.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "circle 50,50 50,2" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 1 circle 50,50 50,3" f7.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "circle 50,50 50,2" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 0 circle 50,50 50,3" f8.png
%im%\convert.exe -set delay 10 f1.png f2.png f3.png f4.png f5.png f6.png f7.png f8.png -loop 0 sample166.gif

元画像(sample3b.jpg)


出力画像(sample166.gif)


Tuesday, June 05, 2007

ImageMagickで画像を三角形・台形に変形する

ImageMagickで画像を三角形・台形に変形するには、
以下のバッチを実行します。

元画像(sample8.jpg)



rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
rem 右三角%im%\convert.exe sample8.jpg -virtual-pixel background -background white -fx "p{i,(j*w-i*h*0.5)/(w-i)}" sample169a.png


出力画像(sample169a.png)





rem 右台形
%im%\convert.exe sample8.jpg -virtual-pixel background -background white -fx "p{i,(j*w-i*h*0.25)/(w-i*0.5)}" sample169b.png

出力画像(sample169b.png)





rem 左三角
%im%\convert.exe sample8.jpg -virtual-pixel background -background white -fx "p{i,(j*w-(w-i)*h*0.5)/(i+1)}" sample169c.png

出力画像(sample169c.png)





rem 左台形
%im%\convert.exe sample8.jpg -virtual-pixel background -background white -fx "p{i,(j*w-(w-i)*h*0.25)/((w+i)*0.5)}" sample169d.png

出力画像(sample169d.png)






rem 下三角
%im%\convert.exe sample8.jpg -virtual-pixel background -background white -fx "p{(i*h-j*w*0.5)/(h-j),j}" sample169e.png

出力画像(sample169e.png)






rem 下台形
%im%\convert.exe sample8.jpg -virtual-pixel background -background white -fx "p{(i*h-j*w*0.25)/(h-j*0.5),j}" sample169f.png

出力画像(sample169f.png)


rem 上三角
%im%\convert.exe sample8.jpg -virtual-pixel background -background white -fx "p{(i*h-(h-j)*w*0.5)/(j+1),j}" sample169g.png

出力画像(sample169g.png)


rem 上台形
%im%\convert.exe sample8.jpg -virtual-pixel background -background white -fx "p{(i*h-(h-j)*w*0.25)/((h+j)*0.5),j}" sample169h.png

出力画像(sample169d.png)


関連項目
ImageMagickで台形変形を行う

Thursday, May 31, 2007

ImageMagickで特定の色調のモノトーンビデオ風画像に変換する

ImageMagickで特定の色調のモノトーンビデオ風画像に変換するには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
%im%\convert.exe sample8.jpg +contrast +contrast -fx "j%%3!=0?(r*0.8+g*0.8+b*1.4)/3*#7090E0:(r*0.8+g*0.8+b*1.4)/3*0.7*#7090E0" sample168a.png

元画像(sample8.jpg)


出力画像(sample168a.png)

Wednesday, May 30, 2007

ImageMagickで上下左右方向に徐々にモーションブラーをかける

ImageMagickで上下左右方向に徐々にモーションブラーをかけるには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
rem 右に徐々にモーションブラー
%im%\convert.exe sample8.jpg -motion-blur 0x20+180 ( sample8.jpg -channel RGBA -fx "i<w*8/10?p:0" -motion-blur 0x10+180 ) ( sample8.jpg -channel RGBA -fx "i<w*6/10?p:0" -motion-blur 0x5+180 ) ( sample8.jpg -channel RGBA -fx "i<w*4/10?p:0" -motion-blur 0x2+180 ) ( sample8.jpg -channel RGBA -fx "i<w*2/10?p:0" ) -flatten sample167a.png

元画像(sample8.jpg)


出力画像(sample167a.png)


rem 左に徐々にモーションブラー
%im%\convert.exe sample8.jpg -motion-blur 0x20+0 ( sample8.jpg -channel RGBA -fx "i>w*2/10?p:0" -motion-blur 0x10+0 ) ( sample8.jpg -channel RGBA -fx "i>w*4/10?p:0" -motion-blur 0x5+0 ) ( sample8.jpg -channel RGBA -fx "i>w*6/10?p:0" -motion-blur 0x2+0 ) ( sample8.jpg -channel RGBA -fx "i>w*8/10?p:0" ) -flatten sample167b.png

出力画像(sample167b.png)

rem 下に徐々にモーションブラー
%im%\convert.exe sample8.jpg -motion-blur 0x20+270 ( sample8.jpg -channel RGBA -fx "j<h*8/10?p:0" -motion-blur 0x10+270 ) ( sample8.jpg -channel RGBA -fx "j<h*6/10?p:0" -motion-blur 0x5+270 ) ( sample8.jpg -channel RGBA -fx "j<h*4/10?p:0" -motion-blur 0x2+270 ) ( sample8.jpg -channel RGBA -fx "j<h*2/10?p:0" ) -flatten sample167c.png

出力画像(sample167c.png)

rem 上に徐々にモーションブラー
%im%\convert.exe sample8.jpg -motion-blur 0x20+90 ( sample8.jpg -channel RGBA -fx "j>h*2/10?p:0" -motion-blur 0x10+90 ) ( sample8.jpg -channel RGBA -fx "j>h*4/10?p:0" -motion-blur 0x5+90 ) ( sample8.jpg -channel RGBA -fx "j>h*6/10?p:0" -motion-blur 0x2+90 ) ( sample8.jpg -channel RGBA -fx "j>h*8/10?p:0" ) -flatten sample167d.png

出力画像(sample167d.png)


2008/01/04追記
ver6.3.7では、以下のバッチファイルのように-channelの前に-matteを追加します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.7-Q16

rem 右に徐々にモーションブラー
%im%\convert.exe sample8.jpg -motion-blur 0x20+180 ( sample8.jpg
-matte -channel RGBA -fx "i<w*8/10?p:0" -motion-blur 0x10+180 )
( sample8.jpg -matte -channel RGBA -fx "i<w*6/10?p:0" -motion-blur 0x5+180 )
( sample8.jpg -matte -channel RGBA -fx "i<w*4/10?p:0" -motion-blur 0x2+180 )
( sample8.jpg -matte -channel RGBA -fx "i<w*2/10?p:0" ) -flatten sample167a.png

rem 左に徐々にモーションブラー
%im%\convert.exe sample8.jpg -motion-blur 0x20+0 ( sample8.jpg
-matte -channel RGBA -fx "i>w*2/10?p:0" -motion-blur 0x10+0 )
( sample8.jpg -matte -channel RGBA -fx "i>w*4/10?p:0" -motion-blur 0x5+0 )
( sample8.jpg -matte -channel RGBA -fx "i>w*6/10?p:0" -motion-blur 0x2+0 )
( sample8.jpg -matte -channel RGBA -fx "i>w*8/10?p:0" ) -flatten sample167b.png

rem 下に徐々にモーションブラー
%im%\convert.exe sample8.jpg -motion-blur 0x20+270 ( sample8.jpg
-matte -channel RGBA -fx "j<h*8/10?p:0" -motion-blur 0x10+270 )
( sample8.jpg -matte -channel RGBA -fx "j<h*6/10?p:0" -motion-blur 0x5+270 )
( sample8.jpg -matte -channel RGBA -fx "j<h*4/10?p:0" -motion-blur 0x2+270 )
( sample8.jpg -matte -channel RGBA -fx "j<h*2/10?p:0" ) -flatten sample167c.png

rem 上に徐々にモーションブラー
%im%\convert.exe sample8.jpg -motion-blur 0x20+90 ( sample8.jpg
-matte -channel RGBA -fx "j>h*2/10?p:0" -motion-blur 0x10+90 )
( sample8.jpg -matte -channel RGBA -fx "j>h*4/10?p:0" -motion-blur 0x5+90 )
( sample8.jpg -matte -channel RGBA -fx "j>h*6/10?p:0" -motion-blur 0x2+90 )
( sample8.jpg -matte -channel RGBA -fx "j>h*8/10?p:0" ) -flatten sample167d.png

関連項目
ImageMagickで上下左右に画像を徐々にぼかす


Monday, May 28, 2007

ImageMagickで画像を角丸四角に切り取って点線が回転するGIFアニメーションを作成する

ImageMagickで画像を角丸四角に切り取って、
点線が回転するGIFアニメーションを作成するには、
以下のバッチファイルを実行します。



rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
%im%\convert.exe -size 100x100 xc:none -fill white -draw "roundrectangle 1,1 98,98 10,10" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 roundrectangle 2,2 97,97 10,10" f1.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "roundrectangle 1,1 98,98 10,10" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 1 roundrectangle 2,2 97,97 10,10" f2.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "roundrectangle 1,1 98,98 10,10" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 2 roundrectangle 2,2 97,97 10,10" f3.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "roundrectangle 1,1 98,98 10,10" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 3 roundrectangle 2,2 97,97 10,10" f4.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "roundrectangle 1,1 98,98 10,10" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 4 roundrectangle 2,2 97,97 10,10" f5.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "roundrectangle 1,1 98,98 10,10" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 5 roundrectangle 2,2 97,97 10,10" f6.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "roundrectangle 1,1 98,98 10,10" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 6 roundrectangle 2,2 97,97 10,10" f7.png
%im%\convert.exe -size 100x100 xc:none -fill white -draw "roundrectangle 1,1 98,98 10,10" sample3b.jpg -compose srcin -composite -strokewidth 2 -fill none -stroke #c0b49d -draw "stroke-dasharray 4,4 stroke-dashoffset 7 roundrectangle 2,2 97,97 10,10" f8.png
%im%\convert.exe -set delay 10 f1.png f2.png f3.png f4.png f5.png f6.png f7.png f8.png -loop 0 sample165.gif

元画像(sample3b.jpg)



出力画像(sample165.gif)

Sunday, May 27, 2007

ImageMagickで上下左右に画像を徐々にぼかす

ImageMagickで上下左右に画像を徐々にぼかすには、
以下のバッチファイルを実行します。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.4-Q16
rem 右にぼかしていく場合
%im%\convert.exe sample8.jpg -blur 0x4 ( sample8.jpg -channel RGBA -fx "i<w*8/10?p:0" -blur 0x3 ) ( sample8.jpg -channel RGBA -fx "i<w*6/10?p:0" -blur 0x2 ) ( sample8.jpg -channel RGBA -fx "i<w*4/10?p:0" -blur 0x1 ) ( sample8.jpg -channel RGBA -fx "i<w*2/10?p:0" ) -flatten sample164a.png

元画像(sample8.jpg)


出力画像(sample164a.png)

rem 左にぼかしていく場合
%im%\convert.exe sample8.jpg -blur 0x4 ( sample8.jpg -channel RGBA -fx "i>w*2/10?p:0" -blur 0x3 ) ( sample8.jpg -channel RGBA -fx "i>w*4/10?p:0" -blur 0x2 ) ( sample8.jpg -channel RGBA -fx "i>w*6/10?p:0" -blur 0x1 ) ( sample8.jpg -channel RGBA -fx "i>w*8/10?p:0" ) -flatten sample164b.png

出力画像(sample164b.png)


rem 下にぼかしていく場合
%im%\convert.exe sample8.jpg -blur 0x4 ( sample8.jpg -channel RGBA -fx "j<h*8/10?p:0" -blur 0x3 ) ( sample8.jpg -channel RGBA -fx "j<h*6/10?p:0" -blur 0x2 ) ( sample8.jpg -channel RGBA -fx "j<h*4/10?p:0" -blur 0x1 ) ( sample8.jpg -channel RGBA -fx "j<h*2/10?p:0" ) -flatten sample164c.png

出力画像(sample164c.png)


rem 上にぼかしていく場合
%im%\convert.exe sample8.jpg -blur 0x4 ( sample8.jpg -channel RGBA -fx "j>h*2/10?p:0" -blur 0x3 ) ( sample8.jpg -channel RGBA -fx "j>h*4/10?p:0" -blur 0x2 ) ( sample8.jpg -channel RGBA -fx "j>h*6/10?p:0" -blur 0x1 ) ( sample8.jpg -channel RGBA -fx "j>h*8/10?p:0" ) -flatten sample164d.png

出力画像(sample164d.png)


2008/01/04追記
ver6.3.7では、以下のバッチファイルを実行します。 -channel RGBAの前に-matteを追加しています。

rem 環境によって変えてね
set im=C:\Progra~1\ImageMagick-6.3.7-Q16

rem 右にぼかしていく場合
%im%\convert.exe sample8.jpg -blur 0x4 ( sample8.jpg -matte -channel RGBA
-fx "i<w*8/10?p:0" -blur 0x3 ) ( sample8.jpg -matte -channel RGBA
-fx "i<w*6/10?p:0" -blur 0x2 ) ( sample8.jpg -matte -channel RGBA
-fx "i<w*4/10?p:0" -blur 0x1 ) ( sample8.jpg -matte -channel RGBA
-fx "i<w*2/10?p:0" ) -flatten sample164a.png

rem 左にぼかしていく場合
%im%\convert.exe sample8.jpg -blur 0x4 ( sample8.jpg -matte -channel RGBA
-fx "i>w*2/10?p:0" -blur 0x3 ) ( sample8.jpg -matte -channel RGBA
-fx "i>w*4/10?p:0" -blur 0x2 ) ( sample8.jpg -matte -channel RGBA
-fx "i>w*6/10?p:0" -blur 0x1 ) ( sample8.jpg -matte -channel RGBA
-fx "i>w*8/10?p:0" ) -flatten sample164b.png

rem 下にぼかしていく場合
%im%\convert.exe sample8.jpg -blur 0x4 ( sample8.jpg -matte -channel RGBA
-fx "j<h*8/10?p:0" -blur 0x3 ) ( sample8.jpg -matte -channel RGBA
-fx "j<h*6/10?p:0" -blur 0x2 ) ( sample8.jpg -matte -channel RGBA
-fx "j<h*4/10?p:0" -blur 0x1 ) ( sample8.jpg -matte -channel RGBA
-fx "j<h*2/10?p:0" ) -flatten sample164c.png

rem 上にぼかしていく場合
%im%\convert.exe sample8.jpg -blur 0x4 ( sample8.jpg -matte -channel RGBA
-fx "j>h*2/10?p:0" -blur 0x3 ) ( sample8.jpg -matte -channel RGBA
-fx "j>h*4/10?p:0" -blur 0x2 ) ( sample8.jpg -matte -channel RGBA
-fx "j>h*6/10?p:0" -blur 0x1 ) ( sample8.jpg -matte -channel RGBA
-fx "j>h*8/10?p:0" ) -flatten sample164d.png