No output generated in [!1]

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: No output generated in [!1]

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: No output generated in [!1]

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: No output generated in [!1]

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: No output generated in [!1]

Post by anthony »

Sorry space at the end? I don't follow.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: No output generated in [!1]

Post by el_supremo »

This "[!1]" doesn't work, but this "[!1] " does.

Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: No output generated in [!1]

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No output generated in [!1]

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: No output generated in [!1]

Post 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.
Post Reply