Question

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"

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top