[Image-SIG] How to improve rotation quality?

Alec Bennett wrybread at gmail.com
Wed Feb 17 12:30:23 CET 2010

I'm wondering if anyone has any idea how to get better results from PIL's
rotate() function? No matter what filter I use I'm getting very jagged edges
after rotating an image.

Here's how I'm invoking the filters:

pic = pic.rotate(random_rotation, resample=Image.NEAREST, expand=1)
pic = pic.rotate(random_rotation, resample=Image.BILINEAR, expand=1)
pic = pic.rotate(random_rotation, resample=Image.BICUBIC, expand=1)    # the
best I think

I posted a sample app that opens an image and rotates it using each of the
filters. You can see the jagged edges pretty plainly.

I have a slideshow app that I'm working on where these edges are very
obvious, so I'm wondering if anyone might have any tips on getting better
results from rotate(), or from some other method or module that might do a
better job?

My very simple sample app that tests each of the filters is here:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20100217/eca5d534/attachment.htm>

More information about the Image-SIG mailing list