colour.domain_range_scale#

class colour.domain_range_scale(scale: Literal['ignore', 'reference', 'Ignore', 'Reference', '1', '100'] | str)[source]#

Define context manager and decorator temporarily setting Colour domain-range scale.

The following scales are available:

  • ‘Reference’, the default Colour domain-range scale which varies depending on the referenced algorithm, e.g. [0, 1], [0, 10], [0, 100], [0, 255], etc…

  • ‘1’, a domain-range scale normalised to [0, 1], it is important to acknowledge that this is a soft normalisation and it is possible to use negative out of gamut values or high dynamic range data exceeding 1.

Parameters:

scale (Literal['ignore', 'reference', 'Ignore', 'Reference', '1', '100'] | str) – Colour domain-range scale to set.

Warning

  • The ‘Ignore’ and ‘100’ domain-range scales are for internal usage only!

Examples

With Colour domain-range scale set to ‘Reference’:

>>> with domain_range_scale("1"):
...     to_domain_1(1)
array(1.0)
>>> with domain_range_scale("Reference"):
...     from_range_1(1)
array(1.0)

With Colour domain-range scale set to ‘1’:

>>> with domain_range_scale("1"):
...     to_domain_1(1)
array(1.0)
>>> with domain_range_scale("1"):
...     from_range_1(1)
array(1.0)

With Colour domain-range scale set to ‘100’ (unsupported):

>>> with domain_range_scale("100"):
...     to_domain_1(1)
array(0.01)
>>> with domain_range_scale("100"):
...     from_range_1(1)
array(100.0)
__init__(scale: Literal['ignore', 'reference', 'Ignore', 'Reference', '1', '100'] | str) None[source]#
Parameters:

scale (Literal['ignore', 'reference', 'Ignore', 'Reference', '1', '100'] | str) –

Return type:

None

Methods

__init__(scale)