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.
Rotation around a point
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Rotation around a point
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.
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
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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Rotation around a point
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
http://www.imagemagick.org/Usage/distor ... t_viewport
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/