Page 1 of 1

writing text diagonally

Posted: 2010-10-27T05:56:54-07:00
by manit
I used the command

convert -size 200x200 xc:white -pointsize 20 -draw "rotate 315 text 0,200 'good'" out.jpg

I was expecting I will get 'good' written starting from bottom left corner towards top right .
Instead the direction is alright but origin point is not as desired .

Re: writing text diagonally

Posted: 2010-10-27T07:32:07-07:00
by Bonzo

Re: writing text diagonally

Posted: 2010-10-27T10:20:40-07:00
by fmw42
try


convert -size 200x200 xc:white -pointsize 20 -gravity southwest -draw "rotate 315 text 10,10 'good'" tmp.jpg

Re: writing text diagonally

Posted: 2010-10-27T21:12:03-07:00
by manit
thank you fnw42 . It worked as desired. I believe southwest gravity sets origin to bottom right & starting from 10,10 ensures that no corner of first letter gets cropped .

To bonzo , shearing using annotate seems difficult because firstly there is x degree & y degree.

Re: writing text diagonally

Posted: 2010-10-27T21:28:49-07:00
by fmw42
manit wrote:thank you fnw42 . It worked as desired. I believe southwest gravity sets origin to bottom right & starting from 10,10 ensures that no corner of first letter gets cropped .

To bonzo , shearing using annotate seems difficult because firstly there is x degree & y degree.

-gravity southwest sets the origin to the bottom left, -gravity southeast sets it to the bottom right and -gravity center will set it to the center, etc

see http://www.imagemagick.org/script/comma ... hp#gravity

Re: writing text diagonally

Posted: 2010-10-27T21:33:16-07:00
by anthony
In a summery and for completeness for anyone else looking at this problem...

There are four basic ways.
  • create label and rotate
    but if you look at the discussion on the old rotate operator you will find it produces a fairly blurry result.
  • create label and rotate using +distort SRT
    this produces a much sharper result and has other options that allow you to control just how blury the result is. It also lets you do a lot more that just rotate the text.
  • draw the text such as someone else previously showed. The various low level MVG commands let you control the rotation and positioning relative to the rotation. See Text Rotation with Translation for examples.
  • Use Annotate
    which is essentially exactly like the last draw command method but without the complexity, and also allows you to read the text from a file or include image properties (size, comments etc) in the annotated string.

the end

Posted: 2010-10-28T04:31:12-07:00
by manit
I understood the annotate operator . It is just that we can rotate x & y axis by as many degrees we want & direction is clockwise.