[Image-SIG] Re: aliasing on resize or thumnail?

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


> 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.

Then why is it even an option in resize(), which doesn't do any geometric
transforms, but only resizing?

> 
> (and the ANTIALIAS filter isn't available in 1.1.2)

Is there such a filter available in other versions?

> 
> 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
> )

That looks like a huge performance hit.  Are you seriously suggesting it?

What about the ImageFilters?  Like perhaps BLUR, BLUR_MORE, SMOOTH,
SMOOTH_MORE?  What exactly are they doing?  Perhaps they could be used to
pre-filter an image before shrinking it?