文字到图片,不断收到错误"没有图像定义"

xol*_*ola 7 text image imagemagick

出于测试目的,我使用imagemagick(最实际的便携式Windows版本)来获取图像的文本.所以我键入以下内容:

convert -font Arial -pointsize 22 -fill black -draw "text 0,0 'TESTTEXT'" test.jpg
Run Code Online (Sandbox Code Playgroud)

但我一直收到这个错误:

convert.exe: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3127.
Run Code Online (Sandbox Code Playgroud)

有人可以告诉我为什么吗?

问候

And*_*rea 3

尝试添加画布并指定尺寸-size 200x100 xc:#ff0000

convert -size 200x100 xc:#ff0000 \
    -font Arial -pointsize 22 \
    -fill black -gravity center \
    -draw "text 0,0 'TESTTEXT'" test.jpg
Run Code Online (Sandbox Code Playgroud)

PS 我还添加了-gravity center将输出图像中的文本居中的功能