W3C home > Mailing lists > Public > www-style@w3.org > November 2014

Re: [css-images] Gamma errors in image downscaling

From: Tavmjong Bah <tav.w3c@gmail.com>
Date: Sun, 09 Nov 2014 21:06:01 +0100
Message-ID: <1415563561.2842.36.camel@localhost.localdomain>
To: Lea Verou <lea@verou.me>
Cc: www-style list <www-style@w3.org>
On Sun, 2014-11-09 at 14:15 -0500, Lea Verou wrote:
> A colleague brought this [1] to my attention, which seems to
> demonstrate an image scaling bug in pretty much every browser I tried
> the testcase [2] on. Furthermore, the results across UAs are
> inconsistent, which might indicate a standardization opportunity. I,
> myself, have noticed similar errors when scaling down certain patterns
> in the past, so stumbling on these issues is not that rare.
> Applying different values to the image-rendering property seems to
> affect the results, but no value produces a correctly downscaled image
> (including the various properietary values…).
> Shouldn’t image-rendering: crisp-edges fix this? Is there any spec
> violation here at all, or is that part of image scaling undefined? Any
> thoughts?

This has to do with using the srgb color space to do scaling. Scaling
should be done in a linear color space. 'crisp-edges' does not fix this
as it doesn't specify which color space to use.

We briefly discussed this at the joint CSS/SVG meeting at TPAC last week
although this part doesn't seem to be minuted. (I showed the bottom of
[3] at the meeting.) High quality image processing software (Photoshop,
Gimp, etc.) has already moved to linear colors spaces, the web should
follow as resources permit.

At the moment there is no CSS property to hint that a linear color space
should be used for scaling (actually, a linear color space should always
be used so a property should not be needed). SVG does have the
'color-interpolation' property value 'linearRGB' to indicate
interpolation (as in gradients, animations, and alpha compositing)
should be done in a linear color space but nobody, that I know of,
implements it. (The SVG 'color-interpolation-filters' property value
'linearRGB' is widely implemented as this is the default value for


> [1]: http://www.4p8.com/eric.brasseur/gamma.html
> [2]: http://www.4p8.com/eric.brasseur/gamma_dalai_lama.html

[3] http://tavmjong.free.fr/SVG/COLOR_INTERPOLATION/index.html
Received on Sunday, 9 November 2014 20:06:32 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:26 UTC