Position issue after rotating text on image

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
timoto
Posts: 3
Joined: 2017-10-16T03:06:04-07:00
Authentication code: 1151

Position issue after rotating text on image

Post by timoto » 2017-10-16T03:26:20-07:00

Hi Friends,
I am facing issue with text position after changing rotation of text on image. Can you please guide / help me to fix the issue?<br/>

Please find attached image for detailed explanation.

Image

Thank You

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

Re: Position issue after rotating text on image

Post by Bonzo » 2017-10-16T04:52:43-07:00

I notice on Stackoverflow you have posted some Imagick code - if that is what you want to use you should say so here.

I think you will need to use a distort function ( SRT ) instead of a rotation in -annotate. Alternativly you could create the text image, rotate and composite it over the photo.

timoto
Posts: 3
Joined: 2017-10-16T03:06:04-07:00
Authentication code: 1151

Re: Position issue after rotating text on image

Post by timoto » 2017-10-16T10:57:10-07:00

Hi Bonzo,

Thank you so much for your reply. Yes i posted code in stack. Can you please provide some example how to use distort function?

Thanks

User avatar
fmw42
Posts: 22083
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Position issue after rotating text on image

Post by fmw42 » 2017-10-16T11:06:17-07:00

To keep the position, you must specify offsets with -gravity center. For example,

Code: Select all

convert -size 300x300 xc:white -fill black -gravity center -font arial -pointsize 24 -annotate +50-50 "some text" tmp.png
Image

Code: Select all

convert -size 300x300 xc:white -fill black -gravity center -font arial -pointsize 24 -annotate 30x30+50-50 "some text" tmp2.png
Image

timoto
Posts: 3
Joined: 2017-10-16T03:06:04-07:00
Authentication code: 1151

Re: Position issue after rotating text on image

Post by timoto » 2017-10-16T12:47:02-07:00

Thank you so much for your example. I will try

Post Reply