Page 1 of 1

problems escaping quotes in image label

Posted: 2007-09-25T13:16:49-07:00
by mattalexx
I'm using the text-to-image functionality. I want to be able to apply text that contains quotes, but I'm having a difficult time getting it to work. I want to be able to apply text that contains both single and double quotes.

Here's an attempt using a backslash, but it doesn't save the image at all:

Code: Select all

/usr/bin/convert -background 'rgb(255, 255, 255)' -fill 'rgb(250, 184, 5)' -font /[FONT_FOLDER]/OzHandicraftBT.ttf -pointsize 38 label:'page o\' clients' +trim /[MY_SAVE_FOLDER]/5a2c87ef6077ee551d1871dce412ade3.png
Then I tried writing a SQL-type escape by repeating the single quote. The image saved at least, but without the quote. Here's the command:

Code: Select all

/usr/bin/convert -background 'rgb(255, 255, 255)' -fill 'rgb(250, 184, 5)' -font /[FONT_FOLDER]/OzHandicraftBT.ttf -pointsize 38 label:'page o'' clients' +trim /[MY_SAVE_FOLDER]/5a2c87ef6077ee551d1871dce412ade3.png
What is the best solution to this problem. I would use double quotes to enclose the quote, but I want to be able to apply both single and double quotes to the same image.

Re: problems escaping quotes in image label

Posted: 2007-09-25T13:20:41-07:00
by mattalexx
I've found the solution: Use double quotes to enclose the text and escape the double quotes witgh backslashes.

Re: problems escaping quotes in image label

Posted: 2007-09-25T18:00:51-07:00
by anthony
this is a 'shell' problem in its interpretation of what is an argument.

double quotes is the right solution, single quotes can not escape themselves

this works though 'Anthony'\''s Examples'
I leave single quote mode, escape a quote, then re-enter single quote mode.


For more see IM Examples, Draw, To Quote or Backslash?
http://www.imagemagick.org/Usage/draw/#quote