# colour.utilities.to_domain_int#

colour.utilities.to_domain_int(a: ArrayLike, bit_depth: ArrayLike = 8, dtype: Type[DTypeFloat] | None = None) ndarray[Any, dtype[_ScalarType_co]][source]#

Scale given array $$a$$ to int domain. The behaviour is as follows:

• If Colour domain-range scale is ‘Reference’, the definition is almost entirely by-passed and will conveniently convert array $$a$$ to np.ndarray.

• If Colour domain-range scale is ‘1’, array $$a$$ is multiplied by $$2^{bit\_depth} - 1$$.

• If Colour domain-range scale is ‘100’ (currently unsupported private value only used for unit tests), array $$a$$ is multiplied by $$2^{bit\_depth} - 1$$.

Parameters:
• a (ArrayLike) – Array $$a$$ to scale to int domain.

• bit_depth (ArrayLike) – Bit-depth, usually int but can be a numpy.ndarray if some axis need different scaling to be brought to int domain.

• dtype (Type[DTypeFloat] | None) – Data type used for the conversion to np.ndarray.

Returns:

Array $$a$$ scaled to int domain.

Return type:

numpy.ndarray

Notes

• To avoid precision issues and rounding, the scaling is performed on float numbers.

Examples

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

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


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

>>> with domain_range_scale("1"):
...     to_domain_int(1)
array(255.0)


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

>>> with domain_range_scale("100"):
...     to_domain_int(1)
array(2.55)