colour.sRGB_to_XYZ#

colour.sRGB_to_XYZ(RGB: ArrayLike, illuminant: ArrayLike = CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'], chromatic_adaptation_transform: Optional[Union[Literal['Bianco 2010', 'Bianco PC 2010', 'Bradford', 'CAT02 Brill 2008', 'CAT02', 'CAT16', 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ Scaling'], str]] = 'CAT02', apply_cctf_decoding: bool = True) ndarray[source]#

Convert from sRGB colourspace to CIE XYZ tristimulus values.

Parameters:
  • RGB (ArrayLike) – sRGB colourspace array.

  • illuminant (ArrayLike) – Source illuminant chromaticity coordinates.

  • chromatic_adaptation_transform (Optional[Union[Literal['Bianco 2010', 'Bianco PC 2010', 'Bradford', 'CAT02 Brill 2008', 'CAT02', 'CAT16', 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ Scaling'], str]]) – Chromatic adaptation transform.

  • apply_cctf_decoding (bool) – Whether to apply the sRGB decoding colour component transfer function / electro-optical transfer function.

Returns:

CIE XYZ tristimulus values.

Return type:

numpy.ndarray

Notes

Domain

Scale - Reference

Scale - 1

RGB

[0, 1]

[0, 1]

Range

Scale - Reference

Scale - 1

XYZ

[0, 1]

[0, 1]

Examples

>>> import numpy as np
>>> RGB = np.array([0.70573936, 0.19248266, 0.22354169])
>>> sRGB_to_XYZ(RGB)  
array([ 0.2065429...,  0.1219794...,  0.0513714...])