(Rotate) query on win-com-line (test code inside)

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
Ravinderjit S.Sidhu

(Rotate) query on win-com-line (test code inside)

Post by Ravinderjit S.Sidhu »

I am trying Rotation in windows platfom on command line:
-----------------------------------------------------------------------------------

Code: Select all

convert -size 2100x1200 xc:white ^
  ( -font  arial  -pointsize 105 -fill rgb(255,0,0)   -draw  " rotate +0 text  100, 100 '1.ImageMagick'" ) ^
  ( -font  arial  -pointsize 105 -fill rgb(0,0,0)     -draw  " rotate +5 text  100, 100 '1.ImageMagick'" ) ^
  ( -font  arial  -pointsize 105 -fill rgb(255,0,0)  -draw  " rotate +0 text  100, 900 '2.ImageMagick'" ) ^
  ( -font  arial  -pointsize 105 -fill rgb(0,0,0)     -draw  " rotate +5 text  100, 900 '2.ImageMagick'" ) ^
  output.BMP

Output
----------
Output.bmp shows two black text lines ("ImageMagicK") at 100,100 location and another at 100,900 location.
Rotation of both the text is "+5".
But the rotation effect of second line is different with first line (Why so?)
and How i can get the good desired result (Please suggest me)

Thanks and Regards
Ravinderjit Singh Sidhu
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: (Rotate) query on win-com-line (test code inside)

Post by anthony »

First parenthesis are not needed as you are only dealing with one image
you are not trying to modify one image separatally to other images in
memory.

OKAY I see your problem....

The "rotate" setting in draw is NOT a text rotate, but a WHOLE CANVAS ROTATE

See IM Examples, Annotating Images, Text Rotation with Translation
http://imagemagick.org/Usage/annotating/#text_rotation

Also see Draw, Warping the Drawing Surface
http://imagemagick.org/Usage/draw/#transform

What you want is to either translate then rotate (the canvas) as shown
in the first link above. OR use annotate to rotate the test BEFORE
it 'draws' it.
http://imagemagick.org/Usage/text/#annotate

It is also a lot simplier than using "draw"
here is a cleaned up version.

Code: Select all

   convert -size 2100x1200 xc:white -font  arial  -pointsize 105 \
            -fill red   -annotate 0x0+100+100 "1.ImageMagick" \
            -fill black -annotate 5x5+100+100 "1.ImageMagick" \
            -fill red   -annotate 0x0+100+900 "2.ImageMagick" \
            -fill black -annotate 5x5+100+900 "2.ImageMagick" \
            win:
The "win:" output displays directly on your screen rather than to a
file. Under UNIX you can use "x:" as well.

PS: Next time use a SMALLER image for testing!!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Ravinderjit S.Sidhu

Re: (Rotate) query on win-com-line (test code inside)

Post by Ravinderjit S.Sidhu »

Thankyou for your very very good guidance, it helped a lot.
Regards
Ravinderjit Singh Sidhu
Post Reply