- From: Chris Lilley via GitHub <sysbot+gh@w3.org>
- Date: Fri, 17 Nov 2023 15:09:33 +0000
- To: public-css-archive@w3.org
svgeesus has just created a new issue for https://github.com/w3c/csswg-drafts: == Linear Bradford matrices are inexact == From [](): > Conversion from colors specified using other white points is called a chromatic adaptation transform, which models the changes in the human visual system as we adapt to a new lighting condition. The Bradford algorithm [[Bradford-CAT]](https://drafts.csswg.org/css-color-4/#biblio-bradford-cat) is the industry standard chromatic adaptation transform, and is easy to calculate as it is a simple matrix multiplication. As pointed out [here](https://github.com/LeaVerou/color.js/pull/352#issuecomment-1815848444) the inverse matrix in color.js uses rounded off values, and in fact the matrices in the specification were calculated using those rounded-off values ```js // Chromatic adaptation function D65_to_D50(XYZ) { // Bradford chromatic adaptation from D65 to D50 // The matrix below is the result of three operations: // - convert from XYZ to retinal cone domain // - scale components from one reference white to another // - convert back to XYZ // http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html var M = [ [ 1.0479298208405488, 0.022946793341019088, -0.05019222954313557 ], [ 0.029627815688159344, 0.990434484573249, -0.01707382502938514 ], [ -0.009243058152591178, 0.015055144896577895, 0.7518742899580008 ] ]; return multiplyMatrices(M, XYZ); } function D50_to_D65(XYZ) { // Bradford chromatic adaptation from D50 to D65 var M = [ [ 0.9554734527042182, -0.023098536874261423, 0.0632593086610217 ], [ -0.028369706963208136, 1.0099954580058226, 0.021041398966943008 ], [ 0.012314001688319899, -0.020507696433477912, 1.3303659366080753 ] ]; return multiplyMatrices(M, XYZ); } ``` which produce small inaccuracies when round-tripping. These can accumulate to the point they introduce small, but visible, artifacts. Also there are also two Bradford transforms: the original, [given in the references section](https://drafts.csswg.org/css-color-4/#biblio-bradford-cat), and the [linear simplification introduced by the ICC](https://ntnuopen.ntnu.no/ntnu-xmlui/bitstream/handle/11250/2626317/CCIW-23.pdf?sequence=1) which is a simple 3x3 matrix. The spec says "linear Bradford" in [11. Converting Colors](https://drafts.csswg.org/css-color-4/#convert-CAT) and elsewhere just uses "Bradford"; that should be corrected for clarity. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9607 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 17 November 2023 15:09:35 UTC