colour.XYZ_to_sRGB#

colour.XYZ_to_sRGB(XYZ: ArrayLike, illuminant: ArrayLike = CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'], chromatic_adaptation_transform: Literal['Bianco 2010', 'Bianco PC 2010', 'Bradford', 'CAT02', 'CAT02 Brill 2008', 'CAT16', 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ Scaling'] | str | None = 'CAT02', apply_cctf_encoding: bool = True) NDArrayFloat[source]#

Convert from CIE XYZ tristimulus values to sRGB colourspace.

Parameters:
  • XYZ (ArrayLike) – CIE XYZ tristimulus values.

  • illuminant (ArrayLike) – Source illuminant chromaticity coordinates.

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

  • apply_cctf_encoding (bool) – Whether to apply the sRGB encoding colour component transfer function / inverse electro-optical transfer function.

Returns:

sRGB colour array.

Return type:

numpy.ndarray

Notes

Domain

Scale - Reference

Scale - 1

XYZ

[0, 1]

[0, 1]

Range

Scale - Reference

Scale - 1

RGB

[0, 1]

[0, 1]

Examples

>>> import numpy as np
>>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
>>> XYZ_to_sRGB(XYZ)  
array([ 0.7057393...,  0.1924826...,  0.2235416...])