While transforming images with PIL (1.1.7, Portable Python 2.7.5.1, Windows 7) I stumbled upon a behaviour I find quite strange. When transforming an image with an identity matrix (1,0,0,0,1,0,0) I expect the resulting image to be the exact input (as when using OpenCV). With filter=Image.NEAREST that holds true but not for Image.BILINEAR or Image.BICUBIC. The image is translated to the bottom right.

import Image
import ImageDraw
im = Image.new('L', (64, 64), 0)
draw = ImageDraw.Draw(im)
draw.line((8,8, 32,8), fill=255)
draw.line((8,8, 8,32), fill=255)
im.save('out1.png')
im = im.transform((64, 64), Image.AFFINE, (1,0,0,0,1,0), Image.BICUBIC)
im.save('out2.png')
im = im.transform((64, 64), Image.AFFINE, (1,0,0,0,1,0), Image.BICUBIC)
im.save('out3.png')
im = im.transform((64, 64), Image.AFFINE, (1,0,0,0,1,0), Image.BICUBIC)
im.save('out4.png')

[1]: http://i.stack.imgur.com/1gktU.png
[2]: http://i.stack.imgur.com/gxePy.png
[3]: http://i.stack.imgur.com/kSYm1.png
[4]: http://i.stack.imgur.com/YhgGf.png

Is this intended (I was unable to find something about this in the docs.) or a bug?
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to