[Image-SIG] downscaling by area averaging

Fredrik Lundh fredrik at pythonware.com
Fri May 6 12:26:34 CEST 2005


Douglas Bagnall wrote:

> I've made a patch to resize by averaging pixels.
>
> http://halo.gen.nz/pil/pil_area_average.patch
>
> If people want it, I'll fix up the GCCisms, and make it work on other
> than RGB images.

looks interesting, but in theory (and without analyzing your
code), shouldn't this be the same as running ImagingStretch
with the nearest filter?  (=an adaptive box filter)

(guess I'll have to do some experiments...  I've been meaning to
switch to ImagingStretch for all downsampling uses, but haven't
had time to tune the filters yet (=make them behave the same
as the upsampling filters).  this might be the prodding I needed)

> Interestingly, the area averaged image is generally pixel perfect with
> the Gimp's best resizing ("Cubic").

that's odd.  what kind of source images are you processing?

</F>





More information about the Image-SIG mailing list