【问题标题】:How to overlay transparent text with background on picture?如何在图片上覆盖带有背景的透明文本?
【发布时间】:2018-07-05 11:33:15
【问题描述】:

我有一张背景图片。现在我想画一个圆角矩形,上面有一个文字形状的孔。我必须先画面具吗?


更新:我希望通过文本显示图片,而不是圆角矩形。我的转换命令版本是 6.9.7,在 Linux 上。

【问题讨论】:

    标签: imagemagick imagick imagemagick-convert


    【解决方案1】:

    抱歉,我仍然不确定我是否理解您对圆角矩形的要求。但这是一种计算白色圆角矩形的方法,将透明文本放入其中,然后将其覆盖在 lena 背景图像上。

    convert \( -size 150x150 xc:white \) \
    \( +clone  -alpha extract \
    -draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0' \
    \( +clone -flip \) -compose Multiply -composite \
    \( +clone -flop \) -compose Multiply -composite \
    \) -alpha off -compose CopyOpacity -composite \
    \( -size 100x100 -background none -fill white -gravity center \
    -pointsize 36 -font arial label:"TEST"  \) \
    -gravity center -compose dstout -composite -alpha on \
    lena.png +swap -compose over -composite tmp.png
    

    【讨论】:

    • 没错。非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多