Skip to content

Commit

Permalink
[spaces/prophoto] Use 64 bit-accurate conversion matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
svgeesus committed Dec 18, 2023
1 parent efb6e7d commit f750d09
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/spaces/prophoto-linear.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import XYZ_D50 from "./xyz-d50.js";

// convert an array of prophoto-rgb values to CIE XYZ
// using D50 (so no chromatic adaptation needed afterwards)
// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
// matrix cannot be expressed in rational form, but is calculated to 64 bit accuracy
// see https://github.com/w3c/csswg-drafts/issues/7675
const toXYZ_M = [
[ 0.7977604896723027, 0.13518583717574031, 0.0313493495815248 ],
[ 0.2880711282292934, 0.7118432178101014, 0.00008565396060525902 ],
[ 0.0, 0.0, 0.8251046025104601 ]
[ 0.79776664490064230, 0.13518129740053308, 0.03134773412839220 ],
[ 0.28807482881940130, 0.71183523424187300, 0.00008993693872564 ],
[ 0.00000000000000000, 0.00000000000000000, 0.82510460251046020 ]
];

const fromXYZ_M = [
[ 1.3457989731028281, -0.25558010007997534, -0.05110628506753401 ],
[ -0.5446224939028347, 1.5082327413132781, 0.02053603239147973 ],
[ 0.0, 0.0, 1.2119675456389454 ]
[ 1.34578688164715830, -0.25557208737979464, -0.05110186497554526 ],
[ -0.54463070512490190, 1.50824774284514680, 0.02052744743642139 ],
[ 0.00000000000000000, 0.00000000000000000, 1.21196754563894520 ]
];

export default new RGBColorSpace({
Expand Down

0 comments on commit f750d09

Please sign in to comment.