Page 1 of 1

Position issue after rotating text on image

Posted: 2017-10-16T03:26:20-07:00
by timoto
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

Re: Position issue after rotating text on image

Posted: 2017-10-16T04:52:43-07:00
by Bonzo
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.

Re: Position issue after rotating text on image

Posted: 2017-10-16T10:57:10-07:00
by timoto
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

Re: Position issue after rotating text on image

Posted: 2017-10-16T11:06:17-07:00
by fmw42
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

Re: Position issue after rotating text on image

Posted: 2017-10-16T12:47:02-07:00
by timoto
Thank you so much for your example. I will try