Image magick 创建具有特定像素宽度的 img

Image magick create img with specific pixel width

我正在创建这张图片:

使用这个命令:

convert -size 720x480 xc:black -strokewidth 5 -stroke lime -draw "line 105,400 205,400" -stroke blue -draw "line 105,405 205,405" -stroke blue -strokewidth 2 -draw "rectangle 140,150 260,230 " -draw "rectangle 320,150 440,230 " -draw "rectangle 500,150 620,230 " -draw "rectangle 140,300 260,380 " -draw "rectangle 320,300 440,380 " -draw "rectangle 500,300 620,380 " test.png

但我的图片应该是这样的:

每个矩形的宽度为 180px,高度为 120px,green/blue 线的宽度为 170px,高度为 10px,我该如何指定?

我尝试了 rostok 的建议,它为我创建了这张图片,但并非 100% 正确:

试试这个:

magick convert \
-size 720x480 xc:black \
-strokewidth 4 \
-stroke lime \
-draw "line 103,467 273,467" \
-stroke #0030ff \
-draw "line 103,471 273,471" \
-strokewidth 9 \
-draw "path 'M 108,159 h 171 v 111 h -171 v -115 Z'" \
-draw "path 'M 290,159 h 171 v 111 h -171 v -115 Z'" \
-draw "path 'M 472,159 h 171 v 111 h -171 v -115 Z'" \
-draw "path 'M 108,288 h 171 v 111 h -171 v -115 Z'" \
-draw "path 'M 290,288 h 171 v 111 h -171 v -115 Z'" \
-draw "path 'M 472,288 h 171 v 111 h -171 v -115 Z'" \
output.png 

您的矩形在水平和垂直方向上的笔划宽度不同,但我假设您希望所有位置都具有相同的笔划。