imagemagickmagick++

reference coordinates after rotate with magick++


I am writing a C++ program that rotates an image a defined amount of degrees and then needs to crop a specific area of the rotated image. However I have noticed that the coordinate system changes after rotation and have not been able to find documentation stating how it changes.

(i.e. if after rotation I crop an area starting at 0,0, the resulting image is from an area lower and to the right)

So far I have noticed that it rotates around the center and if the width is larger by n, then x starts at -n/2. What happens if width was reduced? i.e. if a rectangular image was rotated 90 degrees?

Is there an easy way to get it? or documented somewhere?

Thank you


Solution

  • Thankyou.

    This is a client-server with the client being a canvas in a web browser where there have taken place trigonometric calculations to find rotation angles and selection of an area to crop.

    In the client, the rotation is done around the upper-left corner of the canvas. Confirmation about my asumption that imageMagick rotates around the center of the image in an imaginary plane would have been enough.

    I decided to go the repage route as it saves time and avoids posible future complications if apis were to change. iMagick++ has such Method in its Image class.