文字ごとに背景色が異なる文字列を描画するには、以下のWSHスクリプトを実行します。
wb-letters.vbs
-----------------
Set im = CreateObject("ImageMagickObject.MagickImage.1")
rem 出力文字列(英文字のみ)
message_string = "ImageMagick"
color1="#ffffff"
color2="#000000"
For wl=1 to Len(message_string)
ch = Mid(message_string,wl,1)
If (wl mod 2) = 0 then
current1 = color1
current2 = color2
else
current1 = color2
current2 = color1
end if
im.Convert "-size", "20x20", "xc:" & current1, "-fill", current2, _
"-font", "Tahoma-Bold", "-gravity", "center", "-draw", _
"font-size 15 text 0,0 '" & ch & "'", "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.exe wb-letters.vbs
出力画像(output.png)
No comments:
Post a Comment