具有透明背景的 Imagemagick 文本

utd*_*dev 6 image imagemagick imagick

我想用图像魔法创建一个图像,它为我创建一个具有透明背景的文本。

到目前为止,我使用了这段代码,但它为我创建了黑色背景。

convert -debug annotate -size 720x480 -background none xc:black -fill white -stroke white -font Arial -pointsize 16 90x25 -draw "text 120,370 'move'"-font Arial -pointsize 16 50x25 -draw "text 250,370 'text'"-font Arial -pointsize 16 105x25 -draw "text 360,370 'images'"-font Arial -pointsize 16 115x25 -draw "text 500,370 'another text'" TextTransp.png
Run Code Online (Sandbox Code Playgroud)

该文件应为 .png。基本上应该有一个带有透明背景的白色文本。

Mar*_*ell 6

我认为你需要xc:none而不是xc:black像这样:

convert -size 720x480 xc:none -draw "text 200,50 'Hello there'" result.png
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

(我添加了红色边框,以便您可以看到它的范围。)