colour.RGB_to_YcCbcCrc(RGB: ArrayLike, out_bits: int = 10, out_legal: bool = True, out_int: bool = False, is_12_bits_system: bool = False, **kwargs: Any) numpy.ndarray[source]

Convert an array of RGB linear values to the corresponding Yc’Cbc’Crc’ colour encoding values array.

  • RGB (ArrayLike) – Input RGB array of linear float values.

  • out_bits (int) – Bit depth for integer output, or used in the calculation of the denominator for legal range float values, i.e. 8-bit means the float value for legal white is 235 / 255. Ignored if out_legal and out_int are both False. Default is 10.

  • out_legal (bool) – Whether to return legal range values. Default is True.

  • out_int (bool) – Whether to return values as out_bits integer code values. Default is False.

  • is_12_bits_system (bool) – Recommendation ITU-R BT.2020 OETF (OECF) adopts different parameters for 10 and 12 bit systems. Default is False.

  • out_range – Array overriding the computed range such as out_range = (Y_min, Y_max, C_min, C_max). If out_range is undefined, Y_min, Y_max, C_min and C_max will be computed using colour.models.rgb.ycbcr.ranges_YCbCr() definition.

  • kwargs (Any) –


Yc’Cbc’Crc’ colour encoding array of integer or float values.

Return type



Domain *

Scale - Reference

Scale - 1


[0, 1]

[0, 1]

Range *

Scale - Reference

Scale - 1


[0, 1]

[0, 1]

* This definition has input and output integer switches, thus the domain-range scale information is only given for the floating point mode.


This definition is specifically for usage with Recommendation ITU-R BT.2020 when adopting the constant luminance implementation.


[InternationalTUnion15a], [Wikipedia04e]


>>> RGB = np.array([0.18, 0.18, 0.18])
>>> RGB_to_YcCbcCrc(RGB, out_legal=True, out_bits=10, out_int=True,
...                 is_12_bits_system=False)
array([422, 512, 512]...)