[whatwg] Canvas element image scaling

Boris Zbarsky bzbarsky at MIT.EDU
Sat Sep 18 19:42:18 PDT 2010


On 9/18/10 9:57 PM, Rob Evans wrote:
> Thanks for the reply. I’m already using high resolution images and I
> cannot cut sections of the image off because I am not using canvas to
> create thumbnails, I’m using it to create a game engine. I guess this is
> a question I will have to take up with the Firefox and Chrome developers
> directly, unless there are any devs here that know why I’m seeing a
> dramatic difference in scaling quality?

Gecko will scale canvas images in one of two ways: either using a 
nearest-neighbor algorithm or using a more complicated (bilinear, 
bicubic, may depend on other details) algorithm which is slower but 
usually gives better results.  You can control which is happening by 
setting mozImageSmoothingEnabled on the canvas 2d context (set to false 
to get nearest-neighbor and set to true to get the other).

The default value there is true.  Does setting it to false give you the 
Chrome 6 behavior, perchance?  I'd be a little surprised if it does, but 
worth trying.

-Boris



More information about the whatwg mailing list