Problem with Annotate method + text rotation

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
spok
Posts: 36
Joined: 2011-10-31T07:32:23-07:00
Authentication code: 8675308

Problem with Annotate method + text rotation

Post by spok »

I'd like to annotate an image with a text which can be rotated by 0,90, 180 or 270 degrees.
The angle is not known in advance. The font size also is not known in advance.
I use the gravity to choose the text position.
When the gravity is in the center, everything works well.
However when the gravity is in another position (corner for example) if I use the angle parameter of the annotate method to rotate the text, then the text disappears outside the image.
How can I make the text stay inside the image after the rotation ?
spok
Posts: 36
Joined: 2011-10-31T07:32:23-07:00
Authentication code: 8675308

Re: Problem with Annotate method + text rotation

Post by spok »

Finally I found another solution.
I created a new pic with the same size as the image and with a transparent backgound.
Then I annotated this new image with the text.
Then I croped this image with boundingBox method to obtain an image only with a size correponding to the text inside.
The I rotated this image.
And finally I used composite with the original image.
Post Reply