Friday, March 02, 2007

ImageMagickで旗がなびくようなGIFアニメーションを作成する

ImageMagickで旗がなびくようなGIFアニメーションを作成するには、
以下のバッチファイルを実行します。

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

%im%\convert.exe sample7.jpg -fx (1+cos(pi*i/20)*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*i/20)*5} f1.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+0.4))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*(i/20+0.4))*5} f2.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+0.8))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*(i/20+0.8))*5} f3.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+1.2))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*(i/20+1.2))*5} f4.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+1.6))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*(i/20+1.6))*5} f5.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+2.0))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*(i/20+2.0))*5} f6.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+2.4))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos((pi*i/20+2.4))*5} f7.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+2.8))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*(i/20+2.8))*5} f8.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+3.2))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*(i/20+3.2))*5} f9.gif
%im%\convert.exe sample7.jpg -fx (1+cos(pi*(i/20+3.6))*0.2)*p -mattecolor black -frame 10x10 -fx p{i,j+cos(pi*(i/20+3.6))*5} f10.gif
%im%\convert.exe f1.gif f2.gif f3.gif f4.gif f5.gif f6.gif f7.gif f8.gif f9.gif f10.gif -set delay 15 -loop 0 sample91.gif

元画像(sample7.jpg)


出力画像(sample91.gif)

No comments: