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

RGB —> XYZ

var_R = ( R / 255 )        //R from 0 to 255
var_G = ( G / 255 )        //G from 0 to 255
var_B = ( B / 255 )        //B from 0 to 255

if ( var_R > 0.04045 ) var_R = ( ( var_R + 0.055 ) / 1.055 ) ^ 2.4
else                   var_R = var_R / 12.92
if ( var_G > 0.04045 ) var_G = ( ( var_G + 0.055 ) / 1.055 ) ^ 2.4
else                   var_G = var_G / 12.92
if ( var_B > 0.04045 ) var_B = ( ( var_B + 0.055 ) / 1.055 ) ^ 2.4
else                   var_B = var_B / 12.92

var_R = var_R * 100
var_G = var_G * 100
var_B = var_B * 100

//
Observer. = 2°, Illuminant = D65
X = var_R * 0.4124 + var_G * 0.3576 + var_B * 0.1805
Y = var_R * 0.2126 + var_G * 0.7152 + var_B * 0.0722
Z = var_R * 0.0193 + var_G * 0.1192 + var_B * 0.9505

Top

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