以右对齐文本居中框

Center a box with right aligned text

下面是一个示例,其中有一张背景图片(红色 300x300),我想要一张前景图片(蓝色 100x100),里面有文字。

Want Have
convert -size 300x300 xc:red ( -fill blue -draw rectangle 0,100 100,0  -fill white -pointsize 20 -gravity NorthWest -draw text 0,0 "hello
world" ) -gravity Center

这是在 ImageMagick 中执行此操作的一种方法。 Unix 语法

convert -size 300x300 xc:red \( -size 100x100 -background blue -pointsize 18 -fill white label:"Hello\nWorld" \) -gravity center -compose over -composite result.png

对于 Windows 语法,删除 \ before ( and before )