[Image-SIG] How to improve rotation quality?

Laura & Edward Cannon cannon.el at gmail.com
Wed Feb 17 23:12:41 CET 2010


Try using Image.ANTIALIAS, I find it has the best quality.

On Wed, Feb 17, 2010 at 3:30 AM, Alec Bennett <wrybread at gmail.com> wrote:
> 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:
>
> http://sinkingsensation.com/stuff/rotation_test.zip
>
>
>
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig
>
>


More information about the Image-SIG mailing list