[Image-SIG] downscaling by area averaging

Douglas Bagnall douglas at paradise.net.nz
Fri May 6 04:00:04 CEST 2005


I've made a patch to resize by averaging pixels.


If people want it, I'll fix up the GCCisms, and make it work on other 
than RGB images.

I wrote it for statistical analysis of images (to get the average 
density of various areas).

For every size I tried it proved quicker and more accurate than the 
antialias filter (which, OTOH, is more flexible).

Typical times resizing from 450 x 325 to 16 x 12 are:
         NEAREST:             0.000022
        BILINEAR:             0.000112
         BICUBIC:             0.000192
    AREA_AVERAGE:             0.001558
       ANTIALIAS:             0.009321

(linux, athlon XP 2800+).

The results of this are here:

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

and finally, I just discovered that emacs can save files as syntax 
highlighted html, so here is the guts of the patch in full colour:



Douglas Bagnall

More information about the Image-SIG mailing list