Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function colorCIEXYZtosRGB(XYZ) {
var RGBTEMP = {R:0,
G:0,
B:0};
RGBTEMP.R = 3.2404542 * XYZ.X - 1.5371385 * XYZ.Y - 0.4985314 * XYZ.Z;
RGBTEMP.G =-0.9692660 * XYZ.X + 1.8760108 * XYZ.Y + 0.0415560 * XYZ.Z;
RGBTEMP.B = 0.0556434 * XYZ.X - 0.2040259 * XYZ.Y + 1.0572252 * XYZ.Z;
//converter for 0-255 notation
var cmultiply = 255;
RGBTEMP.R = gamma_sRGB(RGBTEMP.R) * cmultiply;
RGBTEMP.G = gamma_sRGB(RGBTEMP.G) * cmultiply;
RGBTEMP.B = gamma_sRGB(RGBTEMP.B) * cmultiply;
return RGBTEMP;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.