Page 1 of 1

Rotation around a point

Posted: 2009-11-05T18:05:36-07:00
by dargaud
Hello all,
OK, I understand the affine rotationcan do an arbitrary rotation around a point, but I want the result to be still the same dimensions as the original image (the only fixed point being the center of rotation). The way I understand it, the affine transform enlarges the image to the smallest box that encloses the resulting image.

Is there a way to disable that behavior ?
I don't think +repage is the solution here.

Re: Rotation around a point

Posted: 2009-11-05T18:47:50-07:00
by fmw42
use -distort SRT

see http://www.imagemagick.org/Usage/distorts/#srt

it will keep the output the same size, but may clip some of the image after rotation and pad elsewhere. I believe that you can use the virtual-pixel setting to control the kind of padding. So the other way is to precompute the scaling you need to shrink the image so that after a rotation, the image is smaller and fits within the size of the original.

Re: Rotation around a point

Posted: 2009-11-06T03:23:22-07:00
by dargaud
Thank you, SRT works perfectly and is easy to use. Since I'm manipulating 256Mpix images, I really need to figure out how to crop before the rotation in order to optimize the process as you suggest.

Re: Rotation around a point

Posted: 2009-11-08T18:10:51-07:00
by anthony
The distortion can 'crop' the resulting image as part of its processing using the 'viewport' expert option. This defines what part of the 'distorted image space' you want to look at. You will needto use a +repage afterward to remove the virtual offset of the viewport afterward.

http://www.imagemagick.org/Usage/distor ... t_viewport