Page 1 of 1

verticle text

Posted: 2007-09-26T09:14:13-07:00
by troyd1
I have been trying all morning to create a scale. I am having trouble getting the verticle text to work correctly. Here is my command:
convert -size 400x400 xc:white -fill black -draw "line 10,10 50,10" -draw "rotate -90 text 25,25 'text'" test.jpg

Any help on this would be greatly appreciated.

Thanks, Troy

Re: verticle text

Posted: 2007-09-26T10:13:24-07:00
by Bonzo
Not quite sure what you are after Troy; are either of the texts on this page what you want ?
http://rubblewebs.co.uk/imagemagick/text.php

Re: verticle text

Posted: 2007-09-26T13:54:18-07:00
by troyd1
I kind of want to do the lower left one with the text going up. What I am doing is building a percentage scale. The example was only that. I want to create a image that is 40 pixels high by 400 pixels wide. I am going to append this scale to the top of another image of the same size. I want to draw lines of varying length every 5 percent and label like 0, 25, 50, 75 and 100. I want the text to go up(verticle), but cannot get it to draw the text upwards (or downwards). I was just using the 400x400 for testing.

Re: verticle text

Posted: 2007-09-26T14:22:30-07:00
by Bonzo
Something like this ?

Code: Select all

convert -size 40x400 xc:white -fill black -pointsize 8 -draw \"line 0,8 5,8\" -draw \" text 25,10 '5'\" -draw \"line 0,16 10,16\" -draw \" text 25,18 '10'\" -draw \"line 0,24 15,24\" -draw \" text 25,26 '15'\" -draw \"line 0,32 20,32\" -draw \" text 25,34 '20'\" scale.jpg

convert scale.jpg -rotate -90 scale1.jpg
How are you doing this ? If you are using php you could generate the code a lot easer than writting each line and number by hand.

Re: verticle text

Posted: 2007-09-26T17:08:19-07:00
by troyd1
I will be building a command using a program to create it all based on the size dynamically. I did not want you to get wrapped up in the application, I can handle that. I was just wondering how to put text on an image at any angle using the draw command or other command. Like with a line you use starting and ending points. With text there is only a starting point so that you cannot tell it which direction to go. I thought maybe you would do that with the rotate command, but that seems to just rotate the image and not the text. I figured out that I can build the image vertically, put the text on it and rotate it at the end. It still would be nice to be able to say text x,y rotate degrees "enter the text" with x,y bing the anchor point.

Re: verticle text

Posted: 2007-09-27T00:08:42-07:00
by Bonzo
You can rotate text with annotate http://www.imagemagick.org/script/comma ... p#annotate but I still do not think thats what you want ?

What did my example above look like compared to what you want ?

Re: verticle text

Posted: 2007-09-27T08:36:27-07:00
by troyd1
This may get a little long, but here goes. I settled on using the annotate. It works how I want it to.
As a test I did:
convert -size 100x200 xc:white -fill black -draw "50,50 70,50" -fill blue -annotate 270x270+25+50 "test text"
This work great, the anchor point is the beginning of the text, but you can't do negative rotation.
I did get the draw command to work, but could not understand what it was doing. If you use center gravity, it rotates the text on the center of the page. This works great.

If you use no gravity or northwest(the default I believe) it does not rotate on a specific point that I can tell. Try the following, and please explain the results:
convert -size 100x200 xc:white -fill black -draw "50,50 70,50" -fill blue -draw "rotate 10 50,100 "this is test text"
This looks ok
When I start changing the rotate number to 20, 30, 45 or go negative, I get results that I canot figure out. The text does rotate, but moves off the page. I assumed it would rotate with an anchor point based on 50,100 from northwest.

As the annotate works, I am helped, but explaining this may save confusion in the future.

Thanks, Troy

Re: verticle text

Posted: 2007-09-27T19:20:39-07:00
by anthony
Note that no gravity and north-west gravity are not quite the same.
See IM Examples, Image Annotation
http://www.imagemagick.org/Usage/annota ... xt_gravity

The difference is that no gravity does not offset the image baseline for positioning purposes. All the other -gravity definations do offset the image to place the +0+0 position within the image proper.