不規則な形のバッジを作成するには、以下のVBScriptをWSHで実行します。
sample340.vbs
-------------------------------------------------------------
Set im = CreateObject("ImageMagickObject.MagickImage.1")
pi=3.14159
rem 分割数
par = Wscript.Arguments(0)
rem 中心x
cx = Wscript.Arguments(1)
rem 中心y
cy = Wscript.Arguments(2)
rem 半径(大)
rad1 = Wscript.Arguments(3)
rem 半径(小)
rad2 = Wscript.Arguments(4)
rem 描画色
fc = Wscript.Arguments(5)
rem 出力サイズx
ox = Wscript.Arguments(6)
rem 出力サイズy
oy = Wscript.Arguments(7)
rem 半径変動幅
dr = Wscript.Arguments(8)
rem 出力ファイル名
ofile = Wscript.Arguments(9)
dr1=0
dr2=360/(par*2)
dat="polygon "
Do While dr2<360 p1x="int(cx-cos(2*pi*dr1/360)*rad1)" p1y="int(cy-sin(2*pi*dr1/360)*rad1)" drr="dr*rnd()" p2x="int(cx-cos(2*pi*dr2/360)*(rad2+drr))" p2y="int(cy-sin(2*pi*dr2/360)*(rad2+drr))">0 then
dat=dat+","
end if
dat=dat & cstr(p1x) & "," & cstr(p1y) & "," & cstr(p2x) & "," & cstr(p2y)
dr1 = dr1 + 360/par
dr2 = dr2 + 360/par
Loop
im.Convert "-size", ox & "x" & oy, "xc:none", "-fill", fc, "-draw", dat, ofile
Set im = Nothing
-------------------------------------------------------------
実行例:
cscript sample340.vbs 36 100 100 90 80 orange 200 200 8 sample340.png
出力画像(sample340.png)
No comments:
Post a Comment