[Zope] PIL resize aliasing

marc lindahl marc@bowery.com
Wed, 05 Sep 2001 11:18:37 -0400


Finally, got some response...  FYI

----------
> From: "Fredrik Lundh" <fredrik@pythonware.com>
> Date: Wed, 5 Sep 2001 17:00:01 +0200
> To: <image-sig@python.org>
> Subject: Re: [Image-SIG] Re: aliasing on resize or thumnail?
> 
> marc lindahl <marc@bowery.com> wrote:
>>> They do blur the picture a little for me, in comparison if NEAREST. I
>>> believe what is happening - by design - is that BILINEAR and BICUBIC are
>>> just exactly that: they calculate each pixel color from the four pixels
>>> closest to it in the original image.
>> 
>> That's not how it's supposed to work, to be an antialising filter, is it?
> 
> it isn't an anti-aliasing filter: the BILINEAR and BICUBIC resampling
> filters are intended for geometric transforms (rotations, quadrilateral
> warps), not thumbnail generation.
> 
> (and the ANTIALIAS filter isn't available in 1.1.2)
> 
> you can get a better-than-nothing result by resizing multiple times
> with the BILINEAR filter; untested:
> 
> while im.size[0] > size[0] or im.size[1] > size[1]:
> im = im.resize(
> (max(size[0], im.size[0]/2), max(size[1], im.size[1]/2)),
> Image.BILINEAR
> )
> 
> </F>
> 
> 
> 
> _______________________________________________
> Image-SIG maillist  -  Image-SIG@python.org
> http://mail.python.org/mailman/listinfo/image-sig