Page 1 of 1

use newline and special character in text

Posted: 2011-03-17T00:07:01-07:00
by ratneshsoni
convert -size 200x500 xc:none -font arial.ttf -pointsize 20 -fill 'SAMPLE TEXT' \
-stroke '#FF0000' -strokewidth 25 -draw 'text 30,60 'SAMPLE TEXT' \
-stroke none -draw 'text 30,60 'SAMPLE TEXT'\
output.png

i am using this code to create image of text. it is working fine but when i want new line in the text it is not working or when i type special character it gives me error as well.
The sample text value comes from textarea value.
I am also fred to give to text.
and please consider both the type i.e fred and above IM code
so please help regarding this..

Re: use newline and special character in text

Posted: 2011-03-17T09:08:38-07:00
by fmw42
have you tried using double quotes and \n or \012 for new lines?

also it should work with label: rather than -draw or even caption: which will word wrap

see http://www.imagemagick.org/Usage/text/ and esp http://www.imagemagick.org/Usage/text/#label_vertical

Re: use newline and special character in text

Posted: 2011-03-28T05:25:54-07:00
by ratneshsoni
Is it possible with label or caption that i can also apply font stroke and change shape using fred's. Please help me

Re: use newline and special character in text

Posted: 2011-03-28T09:56:14-07:00
by fmw42
label: and caption: recognize -stroke for color and -stroke-width to change the thickness. I am not sure I understand about shape. If you refer to my script, texteffects, then label: and caption: are separate from those effects, but you can combine the shape things with label: and caption:, but you have to code each one separately for your self (or just use my script where that is what I have done). See http://www.imagemagick.org/Usage/text/ and http://www.imagemagick.org/Usage/fonts/

Re: use newline and special character in text

Posted: 2011-03-28T21:49:39-07:00
by ratneshsoni
yes ur right. i am using below code changing font shape, this is example of arc shape. is it possible with this that we can use single qoute(') in between the text or any other special character and newline is well.

./texteffect.sh -t "TEXT" -s outline -e arc-top -a 180 -f Arial -p 48 -c skyblue -b white -o black -l 1 -u lightpink

Re: use newline and special character in text

Posted: 2011-03-29T00:46:02-07:00
by anthony
The ideal way to create a label of text AS IT IS. is put the text in a file or pipeline and feed it to the label using a '@' read from file escape. Any text iread in such a way will not be modified or have percent escapes expanded. Watch out for any final newline in the file or pipeline data, as that will also be used, AS IS, typically creating an extra blank line in the result.
http://www.imagemagick.org/Usage/text/#label_lines