colour.XYZ_to_RGB#

colour.XYZ_to_RGB(XYZ: ArrayLike, colourspace: RGB_Colourspace | LiteralRGBColourspace | str, illuminant: ArrayLike | None = None, chromatic_adaptation_transform: LiteralChromaticAdaptationTransform | str | None = 'CAT02', apply_cctf_encoding: bool = False, *args: Any, **kwargs: Any) NDArrayFloat[source]#

Convert from CIE XYZ tristimulus values to RGB colourspace array.

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

  • colourspace (RGB_Colourspace | LiteralRGBColourspace | str) – Output RGB colourspace.

  • illuminant (ArrayLike | None) – CIE xy chromaticity coordinates or CIE xyY colourspace array of the illuminant for the input CIE XYZ tristimulus values.

  • chromatic_adaptation_transform (LiteralChromaticAdaptationTransform | str | None) – Chromatic adaptation transform, if None no chromatic adaptation is performed.

  • apply_cctf_encoding (bool) – Apply the RGB colourspace encoding colour component transfer function / opto-electronic transfer function.

  • args (Any) – Arguments for deprecation management.

  • kwargs (Any) – Keywords arguments for deprecation management.

Returns:

RGB colourspace array.

Return type:

numpy.ndarray

Notes

Domain

Scale - Reference

Scale - 1

XYZ

[0, 1]

[0, 1]

illuminant_XYZ

[0, 1]

[0, 1]

illuminant_RGB

[0, 1]

[0, 1]

Range

Scale - Reference

Scale - 1

RGB

[0, 1]

[0, 1]

Examples

>>> from colour.models import RGB_COLOURSPACE_sRGB
>>> XYZ = np.array([0.21638819, 0.12570000, 0.03847493])
>>> illuminant = np.array([0.34570, 0.35850])
>>> XYZ_to_RGB(XYZ, RGB_COLOURSPACE_sRGB, illuminant, "Bradford")
... 
array([ 0.4559528...,  0.0304078...,  0.0408731...])
>>> XYZ_to_RGB(XYZ, "sRGB", illuminant, "Bradford")
... 
array([ 0.4559528...,  0.0304078...,  0.0408731...])