[webkit-dev] image downscaling during decoding

Allan Sandfeld Jensen kde at carewolf.com
Mon Aug 13 07:44:59 PDT 2012

On Monday 13 August 2012, Anton Obzhirov wrote:
> Hi,
> We are looking for ways to improve page loading speed and reduce memory
> usage for WebKit in general and for GTK port of WebKit in particular. One
> of the ideas is to implement downscaling of the images during decoding for
> image elements with rectangle less then original image size. At the moment
> such images are full decoded to a full size buffer and get downscaled
> during rendering. It can be quite beneficial in term of memory usage and
> should speed up rendering of the pages like image galleries for example.
> So what are your thoughts about it?
There is already code for that. Check  the IMAGE_DECODER_DOWN_SAMPLING flag,
it currently only downscales image over a certain size and it is not adaptable 
(it does not decoder to a higher res if you zoom), but it works during 
decoding and throws away excess accuracy. Improvements to this would be great.

If you look into the iOS fork of WebKit, you will find they has something less 
precise, but faster, where they can down-scale by powers of 2 (1/2, 1/4, 

Note btw, that some loosy image-formats notably JPEG has a methods of 
decoding, where you get increased pixel-accuracy when decoding to lower 
resolutions, but we currently do not take advantage of this, and it only 
supports down-scale by powers of 2.

Just a few thoughts.

More information about the webkit-dev mailing list