IM annotate/rotate - removes text behind space

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
jeffreyg
Posts: 14
Joined: 2014-02-10T03:42:50-07:00
Authentication code: 6789

IM annotate/rotate - removes text behind space

Post by jeffreyg »

I'm tyring to add some text on the right (east) side of my image. It has to be rotated and all of that works just fine. But for some reason ImageMagick removes every word behind a space. I already tried to remove the spaces and put a bunch of text behind This (Thisdkjlaalkdfsaf) to see if the textfield is limited. But its not, so its got something to do with my code I think.

This is the code I'm using:

Code: Select all

$text = 'This is my text';

exec("new.jpg -rotate -270 -gravity southwest -annotate 0 ".$text." -rotate 270 newimage.jpg");
The only thing thats showing on my image is the word: This
So it doesn't show me: is my text

But I want the textline to say: This is my text

I used this sample code from the ImageMagick site:

Code: Select all

  convert rings.jpg -rotate -90 \
          -gravity South -annotate +0+2 'String' \
          -rotate 90  gravity_text_left.jpg
This is how I want my text placement (in the ImageMagick example its on the left, but I want it on the right):
Image

Source: http://www.imagemagick.org/Usage/annotating/

So I want the full text to be shown: This is my text on the right side (rotated). I'm using ImageMagick version 6.8.1-8 Q16 on Windows 7 32-bit.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: IM annotate/rotate - removes text behind space

Post by snibgo »

Code: Select all

"new.jpg -rotate -270 -gravity southwest -annotate 0 ".$text." -rotate 270 newimage.jpg"
Quotes within quotes generally need escaping. Is this PHP? Maybe it should be \".$text.\" or something.
snibgo's IM pages: im.snibgo.com
jeffreyg
Posts: 14
Joined: 2014-02-10T03:42:50-07:00
Authentication code: 6789

Re: IM annotate/rotate - removes text behind space

Post by jeffreyg »

Thanks you actually fixed it. It is indeed PHP. I already tried a bunch of things with quotes and adding slashes to it for escaping. And I used some different quotes as well, but all didn't seem to work. Now it does. So I might have done something wrong..

Thank you very much!
Post Reply