The point I was trying to make there is that for many format
conversions or encoding conversions (RGB<->YUV, RGB<->HSL), not all
input values are degraded equally. The amount of error introduced
depends on the inputs. There are going to be some values for which the
conversion is more or less accurate - for example, in most cases I
would expect black and white to convert without any error. As a
result, you can't just pick a few random colors and fill a canvas with
them and decide based on that whether or not error is being
introduced. At a minimum, you should use a couple test pattern bitmaps
and do a comparison of the result. Keep in mind that all the
discussions of profile conversion so far have been about bitmaps, not
synthesized solid colors.

I am, of course, not an expert - but I have observed this with
repeated RGB<->HSL conversions in the past (testing poor
implementations that introduced accumulated error against relatively
good implementations that did not accumulate very much error over

Note that as described there, clipping and rounding may occur and
linear <-> gamma-corrected conversions may also occur. We also can't
know what color profile configuration your machine happens to be using
when you run these tests, and what browser you're using. Both of those
are important when saying that you can/can't reproduce the issue.

On Sun, May 18, 2014 at 8:22 AM, Rik Cabanier <> wrote:
> On Sun, May 18, 2014 at 2:15 AM, K. Gadd <> wrote:
>> I'd expect that the error might not accumulate for most color values.
>> Rounding would potentially kick in once you get the first loss of
>> precision.
> That doesn't make sense. If this is a shift because of color management, it
> should happen for pretty much all values.
> I changed my profile to generate wild color shifts and tried random color
> values but don't see any changes in any browser.
> Could this just be happening with images that have profiles?
>> I've only historically seen color shifts upon repeated
>> rendering in scenarios where you're losing lots of precision, or
>> losing energy (bad RGB <-> HSV conversions, for example) - you don't
>> actually need a lot of precision to fix that as long as your
>> coefficients are right.
>> On Fri, May 16, 2014 at 8:41 PM, Rik Cabanier <> wrote:
>> >
>> >
>> >
>> > On Fri, May 16, 2014 at 3:06 PM, Justin Novosad <>
>> > wrote:
>> >>
>> >> On Fri, May 16, 2014 at 5:42 PM, Rik Cabanier <>
>> >> wrote:
>> >>>
>> >>>
>> >>> Is the Web page not composited in sRGB? If so, it seems the backing
>> >>> store
>> >>> should be sRGB too.
>> >>>
>> >>
>> >>
>> >> The web page is not composited in sRGB. It is composited in the output
>> >> device's color space, which is often sRGB or close to sRGB, but not
>> >> always.
>> >> A notable significant exception is pre Snow Leopard Macs that use a
>> >> gamma
>> >> 1.8 transfer curve.
>> >> By the way, sniffing the display color profile through getImageData is
>> >> a
>> >> known fingerprinting technique. This factor alone can be sufficient to
>> >> fingerprint a user who has a calibrated monitor.
>> >
>> >
>> > I'm unable to reproduce what you're describing. So, if I fill with a
>> > color
>> > and repeatedly do a getImageData/putImageData, should I see color
>> > shifts?
>> >

Reply via email to