how to handle apostrophe within text?

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
jpiquemal
Posts: 54
Joined: 2003-12-07T01:57:19-07:00

Post by jpiquemal »

Hello
tested with Windows XP:

-draw "text 0,0 'what\'s new'"

this works perfectly :lol:
Jean
http://www.konvertor.net
mushu

Post by mushu »

Does anyone have a solution for this under linux?

I'm using PHP's exec with commands that look like this:

Code: Select all

/usr/local/bin/convert 2.jpg -resize 150x150! \( 2.jpg -resize 150x150! -blur 2 -fill 'rgba(255,255,255,0.5)' -draw 'rectangle 0,0,150,150' -fill 'rgba(255,255,255,1.0)' -draw 'rectangle 0,50,150,100' -gravity Center -font Harrison.ttf -fill black -pointsize 11 -annotate 0 'Harper's' \) -append 2a.jpg
\' escaping doesn't seem to work with -annotate or -draw.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

The problem is the double quoting screme needed for -draw.
Look at IM examples...
Drawing Special Characters in the Text String
http://www.cit.gu.edu.au/~anthony/graph ... w/#special

You can however now avoid the double quotes and use the recomended method (with image meta data % escapes) -annotate
For example

Code: Select all

   -annotate "That's it! Isn't it?"
See Annotate text to image option...
http://www.cit.gu.edu.au/~anthony/graph ... cape_chars
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mushu

Post by mushu »

That's sorted it. Thanks!
Post Reply