Display \n in the 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
vav

Display \n in the text

Post by vav » 2006-06-06T07:34:57-07:00

How can I escape \n to show it in the text?
I was trying to double backslash, but it doesn't help.

Code: Select all

convert label:'test\\ntest' test.png
produces

Code: Select all

test\
then linebreak and

Code: Select all

test
on the second line.

Bonzo
Posts: 2970
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo » 2006-06-06T11:07:23-07:00

Your lucky vav as I can not get anything to do with text to work :cry:

Can you post your code or PM me a copy so I can see if it works on my server ?

Back to your question; I am not sure what you want to display. Do you want your label to say test \n test ?

Have you tried "test\ntest" instead of 'test\ntest' ?

Anthony

vav

Post by vav » 2006-06-07T00:46:52-07:00

Yes, I'm trying to display text test\ntest.
I'm using IM 6.2.7 under linux.
I've tried:

Code: Select all

convert label:'test\ntest' test.png
convert label:'test\\ntest' test.png
convert label:"test\ntest" test.png
convert label:"test\\ntest" test.png
convert label:test\ntest test.png
convert label:test\\ntest test.png
In all cases I have linebreak instead of characters '\n'.

Bonzo
Posts: 2970
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo » 2006-06-07T10:49:08-07:00

I am afraid I can not help then vav.

The only other things I would try are:

1/ test/ntest - thats a laugh as the forum changed & # 4 7 ; to / ( I have added extra spaces to see if it will display )

2/ Try putting 'test\ntest' into a variable and use the variable in the convert comand instead.

Anthony

Post Reply