Page 1 of 1

Imagemagick and text problems

Posted: 2007-08-24T03:14:17-07:00
by whitto
Hi there,

I am pretty new to imagemagick and have some problems. I don't know how to tell imagemagic that I want to have new line somewhere in my text. From input file it wouldn't be parsed.
My code:

Code: Select all

#!/bin/bash

convert -size 700x \
	-background none \
	-pointsize 45 \
	caption:@- \
	text.png
composite -compose Multiply -gravity center text.png background.jpg result.png
rm text.png
comment: background.jpg is 800x600 image and input text is parsed from file, but where there are \n characters they are not parsed on image as new lines.
How to do that?
Thanks,
Vito.

Re: Imagemagick and text problems

Posted: 2007-08-24T06:30:08-07:00
by Bonzo
I do not know if this will help but this is a link to some tests I have done with word wrapping - php code.

http://www.rubblewebs.co.uk/imagemagick ... d_wrap.php

The text file test is the last one and it seems to wrap OK.

http://www.rubblewebs.co.uk/imagemagick/wrap/text.txt

Re: Imagemagick and text problems

Posted: 2007-08-24T10:39:57-07:00
by whitto
Heh, I tried your solution, but all I have is the same thing. There is no new line!
Image

This is realy strange.
Some more info about my imagemagick:
Version: ImageMagick 6.2.4 02/16/07 Q16
I am running it on xubuntu.
Any idea?
Thanks!

Re: Imagemagick and text problems

Posted: 2007-08-24T22:21:47-07:00
by anthony
A string argument read from a file will be read as 'literal'. That is a new line is a new line and a backslash is just a backslash. No escape codes are applied. This is on purpose as it assumes that any processing of text in a file has been done.

That is to add a new line (or paragrph break) in file text, should REALLY be a newline and not '\n'.

See IM Examples Text to Image Handling,
Special Escape Characters in Text Arguments
http://www.imagemagick.org/Usage/text/#escape_chars

So add your newline to the file!!! And make sure you IM is later than IM v6.3.3
Otherwise pay special attention to the version warning notes.