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

> 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