如何为绘制文本添加背景颜色

use*_*923 6 imagemagick

使用ImageMagick 6.8.1,我的目标是在图像的左下角添加文本,并使文本的背景为黑色.基本上,我想要在我的图像的左下角有一个像20x20黑色区域的东西,而黑色区域有一些文字.除了黑色背景部分外,我已经弄明白了.

这是我到目前为止: convert in.tif -pointsize 10 -background "#000000" -fill white -gravity SouthWest -draw "text 0,0 'a'" out.tif)

小智 9

试试这个,你在寻找底色而不是背景.Undercolor仅填充文本覆盖的区域.

convert in.tif -undercolor Black -pointsize 10 -fill white -gravity SouthWest -annotate 0 'Text String' out.tif