use newline and special character in text

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
ratneshsoni
Posts: 38
Joined: 2010-12-14T03:56:10-07:00
Authentication code: 8675308

use newline and special character in text

Post by ratneshsoni » 2011-03-17T00:07:01-07:00

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

User avatar
fmw42
Posts: 25408
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: use newline and special character in text

Post by fmw42 » 2011-03-17T09:08:38-07:00

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

ratneshsoni
Posts: 38
Joined: 2010-12-14T03:56:10-07:00
Authentication code: 8675308

Re: use newline and special character in text

Post by ratneshsoni » 2011-03-28T05:25:54-07:00

Is it possible with label or caption that i can also apply font stroke and change shape using fred's. Please help me

User avatar
fmw42
Posts: 25408
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: use newline and special character in text

Post by fmw42 » 2011-03-28T09:56:14-07:00

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/

ratneshsoni
Posts: 38
Joined: 2010-12-14T03:56:10-07:00
Authentication code: 8675308

Re: use newline and special character in text

Post by ratneshsoni » 2011-03-28T21:49:39-07:00

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

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: use newline and special character in text

Post by anthony » 2011-03-29T00:46:02-07:00

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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Post Reply