[Image-SIG] [SOLVED] PIL anti-aliased scaling produces bad artifacts?

Edward Cannon edward at unicornschool.org
Mon Aug 9 03:54:58 CEST 2010

I have done this before and it works reasonably well. There is still
some aliasing, but for most part it is perfectly acceptable. BILINEAR
is the way to go.

On Sun, Aug 8, 2010 at 6:31 PM, Angus <charmender at gmail.com> wrote:
>>> I expected the pixels to be increasingly dark. However, the order
>>> seems to be: ...white -> light gray -> dark gray -> black -> *very
>>> dark gray?!* -> black...
>> What you are seeing sounds like ringing artifacts from the lanczos
>> resampling of the ANTIALIAS mode (see
>> http://en.wikipedia.org/wiki/Lanczos_resampling ).
>>> Is this intentional or not? If intentional, is there another way to
>>> anti-alias edges with PIL (because I don't like these artifacts)?
>> You could try something like this:
>> im = im._new(im.im.stretch((15,10), Image.BILINEAR))
>> This will try to do an anti-aliased resizing, but use a bilinear filter
>> instead of the default lanczos filter. This will potentially have more
>> aliasing artifacts, but should have no ringing at all.
>> till then, David.
> That works perfectly for me! Thanks  a lot!
> Interesting explanation too. When I have some more free time I'll have
> to look deeper at the math behind these filters.
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig

More information about the Image-SIG mailing list