如果T
, B
, E
, =
,F
是不同的值,并且P{1..6}
是不同的图像。可能不值得尝试捷径,而是专门构建每一行和每一列。以下示例是一个使用 bash 变量作为占位符的 ImageMagick 命令。
B="-size x15 xc:"
E="-size 5x xc:"
F="-size 10x xc:"
T="-size x25 xc:"
V="-size x20 xc:" # V is an alias for `=`
EQUALLY_SIZED="-size 20x30"
P1="${EQUALLY_SIZED} xc:CadetBlue1"
P2="${EQUALLY_SIZED} xc:firebrick"
P3="${EQUALLY_SIZED} xc:ForestGreen"
P4="${EQUALLY_SIZED} xc:lavender"
P5="${EQUALLY_SIZED} xc:LemonChiffon"
P6="${EQUALLY_SIZED} xc:OldLace"
convert $T \
\( $E $P1 $F $P2 $F $P3 $E +append \) \
$V \
\( $E $P4 $F $P5 $F $P6 $E +append \) \
$B \
-append \
output.png

此示例有效,因为B
, T
, &V
除了高度之外没有任何值。并且E
&F
除了宽度之外没有任何价值。如果我们将FPO间隔图像更新为橙色画布......
O="xc:orange"
B="-size x15 ${O}"
E="-size 5x ${O}"
F="-size 10x ${O}"
T="-size x25 ${O}"
V="-size x20 ${O}" # V alias `=`
...我们可以验证预期的结果。
