错误“不符合绘图基元”当尝试使用图形魔法绘制文本或图像时
我正在将内部使用图像 magick 的 javascript 程序迁移到使用图形 magick 的 Windows 批处理文件。
我无法成功使用 convert -draw
命令。
我有几个非常简单的测试用例。第一个测试用例
gm convert -size 1920x1080 xc:white -draw 'text 8,8 "Hello, world"' test.jpg
失败,并显示错误消息“不合格的绘图基元(文本)”。
另一个
gm convert -size 1920x1080 xc:white -draw 'image over 8,8 0,0 "img.jpg"' test.jpg
因“不合格的绘图基元(图像)”而失败。
从命令行调用和从 BAT 文件内部调用时,它们都会失败。
我尝试过带引号和不带引号 "
。
我尝试过使用 ^
引号 ^"
进行转义。
我尝试转义单引号^'
。
我显然忽略了一些非常简单的事情,我只是看不到。有什么想法吗?
编辑我做了一些尝试......
gm convert -size 1920x1080 xc:white -draw "'text 8,8 Hello'" test.jpg
gm convert -size 1920x1080 xc:white -draw "'text 8,8 \"Hello\"'" test.jpg
gm convert -size 1920x1080 xc:white -draw 'text 8,8 ^"Hello^"' test.jpg
gm convert -size 1920x1080 xc:white -draw "'text 8,8 ""Hello""'" test.jpg
但因
gm convert -size 1920x1080 xc:white -draw "text 8,8 ""Hello"" " test.jpg
“无法读取字体”而失败
I am migrating a javascript program that internally uses image magick, to a Windows batch file using graphics magick.
I cannot succesfully use the convert -draw
command.
I have a couple of very simple test cases.The first one is
gm convert -size 1920x1080 xc:white -draw 'text 8,8 "Hello, world"' test.jpg
fails with the error message "non-conforming drawing primitive (text)".
The other
gm convert -size 1920x1080 xc:white -draw 'image over 8,8 0,0 "img.jpg"' test.jpg
fails with "non-conforming drawing primitive (image)".
They both fail when invoked from the command line and when invoked from inside a BAT file.
I have tried with and without quotes "
.
I have tried escaping with ^
the quotes ^"
.
I have tried escaping the single quotes ^'
.
I am obviously overlooking something very simple, I just cannot see. Any ideas?
EDIT Some attempts I made....
gm convert -size 1920x1080 xc:white -draw "'text 8,8 Hello'" test.jpg
gm convert -size 1920x1080 xc:white -draw "'text 8,8 \"Hello\"'" test.jpg
gm convert -size 1920x1080 xc:white -draw 'text 8,8 ^"Hello^"' test.jpg
gm convert -size 1920x1080 xc:white -draw "'text 8,8 ""Hello""'" test.jpg
but
gm convert -size 1920x1080 xc:white -draw "text 8,8 ""Hello"" " test.jpg
fails with "unable to read font"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用双引号: -draw "image over 8,8,0,0 ""img.jpg"" " ?
Use double quotes: -draw "image over 8,8,0,0 ""img.jpg"" " ?