colour.XYZ_to_RGB#
- colour.XYZ_to_RGB(XYZ: ArrayLike, illuminant_XYZ: ArrayLike, illuminant_RGB: ArrayLike, matrix_XYZ_to_RGB: ArrayLike, chromatic_adaptation_transform: Literal['Bianco 2010', 'Bianco PC 2010', 'Bradford', 'CAT02 Brill 2008', 'CAT02', 'CAT16', 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ Scaling'] | str | None = 'CAT02', cctf_encoding: Callable | None = None) NDArrayFloat [source]#
Convert from CIE XYZ tristimulus values to RGB colourspace array.
- Parameters:
XYZ (ArrayLike) – CIE XYZ tristimulus values.
illuminant_XYZ (ArrayLike) – CIE xy chromaticity coordinates or CIE xyY colourspace array of the illuminant for the input CIE XYZ tristimulus values.
illuminant_RGB (ArrayLike) – CIE xy chromaticity coordinates or CIE xyY colourspace array of the illuminant for the output RGB colourspace array.
matrix_XYZ_to_RGB (ArrayLike) – Matrix converting the CIE XYZ tristimulus values to RGB colourspace array, i.e. the inverse Normalised Primary Matrix (NPM).
chromatic_adaptation_transform (Literal['Bianco 2010', 'Bianco PC 2010', 'Bradford', 'CAT02 Brill 2008', 'CAT02', 'CAT16', 'CMCCAT2000', 'CMCCAT97', 'Fairchild', 'Sharp', 'Von Kries', 'XYZ Scaling'] | str | None) – Chromatic adaptation transform, if None no chromatic adaptation is performed.
cctf_encoding (Callable | None) – Encoding colour component transfer function (Encoding CCTF) or opto-electronic transfer function (OETF).
- Returns:
RGB colourspace array.
- Return type:
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
>>> XYZ = np.array([0.21638819, 0.12570000, 0.03847493]) >>> illuminant_XYZ = np.array([0.34570, 0.35850]) >>> illuminant_RGB = np.array([0.31270, 0.32900]) >>> chromatic_adaptation_transform = "Bradford" >>> matrix_XYZ_to_RGB = np.array( ... [ ... [3.24062548, -1.53720797, -0.49862860], ... [-0.96893071, 1.87575606, 0.04151752], ... [0.05571012, -0.20402105, 1.05699594], ... ] ... ) >>> XYZ_to_RGB( ... XYZ, ... illuminant_XYZ, ... illuminant_RGB, ... matrix_XYZ_to_RGB, ... chromatic_adaptation_transform, ... ) array([ 0.4559557..., 0.0303970..., 0.0408724...])