W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2020

Re: [csswg-drafts] [css-color4] Precision issues when converting colors between Lab and sRGB (#5262)

From: Chris Lilley via GitHub <sysbot+gh@w3.org>
Date: Thu, 25 Jun 2020 20:09:31 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-649791781-1593115770-sysbot+gh@w3.org>
> Conversions sRGB -> XYZ -> sRGB, Lab -> XYZ -> Lab and sRGB -> XYZ(D65) -> XYZ(D50) -> XYZ(D65) -> sRGB are precise as expected which means that either conversion between sRGB and XYZ or between Lab and XYZ are off a bit.

Thanks for the detailed report (especially, of things which do work). I assume that you are carrying out calculations at a higher precision than the end result (ie not doing everything in 8 bits or using 8 bit sRGB as the storage format, which I have seen libraries do).

How are you implementing XYZ? Does it have a flexible whitepoint or do you always assume a D50 whitepoint? Which chromatic adaptation method are you using?

I ask because, depending how you do it, `sRGB -> XYZ -> sRGB` could all be D65, `Lab -> XYZ -> Lab` could be all D50. But they you list `sRGB -> XYZ(D65) -> XYZ(D50) -> XYZ(D65) -> sRGB` which clearly has two chromatic adaptation steps and yet still round-trips.

Lab is known to have higher precision requirements, and should be represented using a triple of floats. The integer 0 -100, -128 - 127 encoding used in Photoshop and in ICC profiles does introduce significant roundoff error and consequent banding. Even representing it as a tripe of 16bit integers is suboptimal.


-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5262#issuecomment-649791781 using your GitHub account
Received on Thursday, 25 June 2020 20:09:32 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:28 UTC