Affine transformatino not accurate
Posted: 2010-04-15T07:58:28-07:00
I rotated an image at 90 degrees. The image theoretically should swap its width and height. However, I got different results:
The origial image has a dimension of 150X88. I expected that the result image dimension is 88X150 but I got 90X152.
I understand that it might be caused by inaccurate floating number math, but is there anyway to improve it so that rotation produces accurate results at 90, 180, 270 degrees?
Code: Select all
convert mouse.png -matte -virtual-pixel transparent -affine 0,1,-1,0,0,0,0 -transform +repage affine_rotate.png
identify mouse.png
mouse.png PNG 150x88 150x88+0+0 DirectClass 8-bit 13.0723kb
identify affine_rotate.png
affine_rotate.png PNG 90x152 90x152+0+0 DirectClass 8-bit 13.0879kb
I understand that it might be caused by inaccurate floating number math, but is there anyway to improve it so that rotation produces accurate results at 90, 180, 270 degrees?