[Image-SIG] PIL 1.1.6 (OSX Leopard and Windows XP) Image.rotate causes very pixelated results

Andrew Ingram andy at andrewingram.net
Fri Jul 25 00:44:38 CEST 2008


I'm trying to get a website to dynamically serve transformed versions of 
uploaded images, initially rotations but also perspective transforms and 
decal overlays.

I'm using PIL and I'm loading images files in, the mode of the images is 

The problem is that when I try to rotate the images the result is highly 
pixelated regardless of the resample option I pass:

m2 = im.rotate(15,resample=Image.NEAREST,expand=1)

gives (visibly) identical results to

m2 = im.rotate(15,resample=Image.BILINEAR,expand=1)


m2 = im.rotate(15,resample=Image.BICUBIC,expand=1)

What I am hoping for the same nature of rotations you might see if using 
photoshop. I appreciate photoshop probably employs some patented 
algorithms but i'd expect to get a result that's somewhat smooth and 
non-jaggy at the very least.

Am I doing something completely wrong, is PIL capable of what I want or 
should I be using something else with python for this kind of image work?

Andrew Ingram

More information about the Image-SIG mailing list