Qix-/color-convert


The issue has been closed
Failure to convert XYZ to RGB and back #81
RobinBol posted onGitHub
Hi, first thanks for this great library!
I have an issue converting an XYZ value to RGB and back, it seems that for some values this works, but for others not. I could not find any range for the XYZ values in the readme (as for the other values), maybe it is related to that?.
This conversion matches (after rounding):
const startXYZ = [47.854955042890886, 29.320696241557958, 21.87902240817543]
const _rgb = convert.xyz.rgb(startXYZ);
const endXYZ = convert.rgb.xyz(_rgb) // => [ 48, 29, 22 ]
However, the following conversion is a mismatch (and quite some other value):
const startXYZ = [ 20, 87, 79 ]
const _rgb = convert.xyz.rgb(startXYZ);
const endXYZ = convert.rgb.xyz(_rgb) // => [ 48, 76, 75 ]
I have been fiddling with the color-space
library as well, but that seems to have the same result (https://github.com/colorjs/color-space/issues/48). Is this a bug in the conversion algorithm?