重疊兩張圖,包含透明的部份用 composite。當然 -fx 也行,變化更多也更不容易控制:
convert background.png overlay.png -composite composite.png
畫圖指令:
# 輸出文字 convert -size 50x15 xc:transparent -fill red -draw 'text 0,15 "Hello"' hello.png # 設定字型 convert -size 50x15 xc:transparent -fill red -font [name|path] -draw 'text 0,15 "Hello"' hello.png # 畫出幾何圖形 convert -size 100x80 xc:transparent -fill yellow -stroke black -strokewidth 3 -draw 'point 10,1 rectangle 10,20 70,40' -draw 'circle 100,80 70,40 ellipse 60,70 30,10 180,720' draw-commands.png # 多邊形、線條 convert -size 100x40 xc:transparent -draw 'line 1,1 50,3 polyline 25,30 40,10 20,0' -draw 'polygon 45,30 60,10 40,0 bezier 65,30 80,10 60,0' lines.png
還有一些要注意的,像是對透明圖作 -fx 處理通常要加上 +matte 才不會把透明度破壞掉。另外我用 -draw 沒辦法畫出中文字,指定 -encoding 或 -font 也是一樣, big5 是亂碼 unicode 是空白。
No comments:
Post a Comment