Friday, February 15, 2008

ImageMagickで影つきの立体的な角丸四角で修飾された文字列を描画する

影つきの立体的な角丸四角で修飾された文字列を描画するには、
以下のVBScriptをWSHで実行します。

sample209.vbs
========================================
Set im = CreateObject("ImageMagickObject.MagickImage.1")
rem 出力文字列(英文字のみ)
message_string = "ImageMagick"

For wl=1 to Len(message_string)
ch = Mid(message_string,wl,1)
If (wl mod 2) = 0 then
rt = "-15"
else
rt = "15"
end if
rem c0b49d
im.Convert "-size", "20x20", "xc:none", "-fill", "#bbddff", "-draw", "roundrectangle 0,0,19,19,5,5", "-font", "Tahoma-Bold", "-gravity", "center", "-fill", "#435184", "-draw", "font-size 15 text 0,0 '" & ch & "'", "-virtual-pixel", "background", "-background", "none", "-rotate", rt, "(", "+clone", "-shade", "135x23", "-blur", "0x2", "-normalize", ")", "-compose", "overlay", "-composite", "(", "+clone", "-background", "#052050", "-shadow", "50x2+1+10", ")", "+swap", "-compose", "src-over", "-background", "white", "-mosaic", "t" & wl & ".png"

if wl = 1 then
im.Convert "t1.png", "output.png"
else
im.Convert "output.png", "t" & wl & ".png", "+append", "output.png"
end if

Next

Set im = Nothing
========================================

実行例
cscript sample209.vbs

出力画像(output.png)



関連項目
ImageMagickで角丸四角で修飾された文字列を描画する

No comments: