Strange behavior of Image::affineTransform
Posted: 2009-01-30T03:48:27-07:00
I think there's a bug in a Image::affineTransform. When I call it with identity matrix I end up with image that is 1 pixel wider and 1 pixel higher then the original. If I apply transformation multiple times, the image gets wider and higher by number of times I applied transformation. Here's a sample code that illustrates my problem:
The resulting image is 1 pixel wider, and 1 pixel higher then the original. Also the image itself is translated by one pixel to the right, and one pixel down.
Is this a bug ? Or am I doing something wrong ?
Code: Select all
Image image("C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/Winter.jpg");
MagickCore::SetImageVirtualPixelMethod(image.image(), MagickCore::ConstantVirtualPixelMethod);
DrawableAffine affine(1.0, 1.0, 0, 0, 0.0, 0.0);
image.affineTransform(affine);
image.write("test.jpg");
The resulting image is 1 pixel wider, and 1 pixel higher then the original. Also the image itself is translated by one pixel to the right, and one pixel down.
Is this a bug ? Or am I doing something wrong ?