Page 1 of 1
Re: No output generated in [!1]
Posted: 2011-10-06T09:26:46-07:00
by el_supremo
IM really doesn't like the "[" and I also can't find a way to escape it. It will generate the string if it is "1!]". But a workaround I stumbled on is to add a space at the end of the string.
Code: Select all
convert -size 100x -background none -font Arial -pointsize 72 -fill "#000000" -gravity west caption:"[!1] " test2.png
If this makes the text image too wide you could use -trim.
Pete
Re: No output generated in [!1]
Posted: 2011-10-06T09:34:07-07:00
by el_supremo
Another workaround is to put the text in a file. If you put [!1] in a text file, say t.txt, this will draw the text properly:
Code: Select all
convert -size 100x -background none -font Arial -pointsize 72 -fill "#000000" -gravity west caption:"@t.txt" test2.png
Pete
Re: No output generated in [!1]
Posted: 2011-10-06T21:22:18-07:00
by anthony
Reading the test for a file, or file stream will prevent IM from using any escapes or other text processing on that string.
You don't have to read a file, but could read from stdin "@-"
Code: Select all
fortune | convert -size 100x caption:"@-" image.png
From a program you can feed the text by using a popen() to run the convert command, and print the text to it.
this is the safest way, to handle any type of text string input, label: caption: -annotate
http://www.imagemagick.org/Usage/text/#label_lines
Re: No output generated in [!1]
Posted: 2011-10-07T00:51:58-07:00
by anthony
Sorry space at the end? I don't follow.
Re: No output generated in [!1]
Posted: 2011-10-07T07:45:30-07:00
by el_supremo
This "[!1]" doesn't work, but this "[!1] " does.
Pete
Re: No output generated in [!1]
Posted: 2011-10-07T09:44:53-07:00
by magick
We can reproduce the problem you reported and have a patch. Look for it in ImageMagick 6.7.3-0 Beta by sometime tomorrow. Thanks.
Re: No output generated in [!1]
Posted: 2011-10-19T16:53:18-07:00
by fmw42
This does not work in IM 6.7.3.1 Q16 Mac OSX Tiger
convert -size 100x -background white -font Arial -pointsize 72 -fill "#000000" -gravity west caption:"[!1]" test2.png
But as el_supremo said, add a space before the closing ] and you get what you wanted anyway without the space showing.
convert -size 100x -background white -font Arial -pointsize 72 -fill "#000000" -gravity west caption:"[!1] " test2.png
Re: No output generated in [!1]
Posted: 2011-10-19T17:23:08-07:00
by magick
We reverted the patch because it broke subimage parsing (.e.g. test.jpg[0]). We will need to revisit the problem and come up with a more robust patch.