colour.models.common Module

Common Colour Models Utilities

Defines various colour models common utilities.

colour.models.common.XYZ_to_sRGB(XYZ, illuminant=(0.31271, 0.32902), chromatic_adaptation_method=u'CAT02', transfer_function=True)[source]

Converts from CIE XYZ colourspace to sRGB colourspace.

Parameters:
  • XYZ (array_like, (3,)) – CIE XYZ colourspace matrix.
  • illuminant (array_like, optional) – Source illuminant chromaticity coordinates.
  • chromatic_adaptation_method (unicode, optional) – (‘XYZ Scaling’, ‘Bradford’, ‘Von Kries’, ‘Fairchild’, ‘CAT02’) Chromatic adaptation method.
  • transfer_function (bool, optional) – Apply sRGB transfer function.
Returns:

sRGB colour matrix.

Return type:

ndarray, (3,)

Notes

  • Input CIE XYZ colourspace matrix is in domain [0, 1].

Examples

>>> XYZ = np.array([0.1180583421, 0.1034, 0.0515089229])
>>> XYZ_to_sRGB(XYZ)  
array([ 0.4822488...,  0.3165197...,  0.2207051...])