Welcome

Guest

Log out

Subscription valid until 2017-02-25



















 

Color conversion math and formulas

These are the formulas used by our Color Calculator.
Each conversion formula is written as a "neutral programming function", easy to be translate in any specific computer language.
If you are searching for more generic information about color, on the Net there are several good sites devoted to color science, physics, psychology, physiology and technology.
Check our Links page or our FAQ page for a list of handy color references.

XYZ —> RGB

var_X = X / 100        //X from 0 to  95.047      (Observer = 2°, Illuminant = D65)
var_Y = Y / 100        //Y from 0 to 100.000
var_Z = Z / 100        //Z from 0 to 108.883

var_R = var_X *  3.2406 + var_Y * -1.5372 + var_Z * -0.4986
var_G = var_X * -0.9689 + var_Y *  1.8758 + var_Z *  0.0415
var_B = var_X *  0.0557 + var_Y * -0.2040 + var_Z *  1.0570

if ( var_R > 0.0031308 ) var_R = 1.055 * ( var_R ^ ( 1 / 2.4 ) ) - 0.055
else                     var_R = 12.92 * var_R
if ( var_G > 0.0031308 ) var_G = 1.055 * ( var_G ^ ( 1 / 2.4 ) ) - 0.055
else                     var_G = 12.92 * var_G
if ( var_B > 0.0031308 ) var_B = 1.055 * ( var_B ^ ( 1 / 2.4 ) ) - 0.055
else                     var_B = 12.92 * var_B

R = var_R * 255
G = var_G * 255
B = var_B * 255

Top

RGB —> XYZ

XYZ —> Yxy

Yxy —> XYZ

XYZ —> Hunter-Lab

Hunter-Lab —> XYZ

XYZ —> CIE-L*ab

CIE-L*ab —> XYZ

CIE-L*ab —> CIE-L*CH°

CIE-L*CH° —>CIE-L*ab

XYZ —> CIE-L*uv

CIE-L*uv —> XYZ

RGB —> HSL

HSL —> RGB

RGB —> HSV

HSV —> RGB

Range of HSL, HSB and HSV in popular applications

RGB —> CMY

CMY —> RGB

CMY —> CMYK

CMYK —> CMY

XYZ (Tristimulus) Reference values of a perfect reflecting diffuser