Error “non-conforming drawing primitive” when trying to draw text or images with graphics magick

大憨熊 提交于 2019-12-20 03:23:30

问题


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"


回答1:


Use double quotes: -draw "image over 8,8,0,0 ""img.jpg"" " ?



来源:https://stackoverflow.com/questions/8700074/error-non-conforming-drawing-primitive-when-trying-to-draw-text-or-images-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!