colour_clf_io.BitDepth#

class colour_clf_io.BitDepth(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

Represents the valid bit depth values of the CLF specification.

Attributes

References

i8 = '8i'#

8-bit unsigned integer.

i10 = '10i'#

10-bit unsigned integer.

i12 = '12i'#

12-bit unsigned integer.

i16 = '16i'#

16-bit unsigned integer.

f16 = '16f'#

16-bit floating point (half-float).

f32 = '32f'#

32-bit floating point (single precision).

scale_factor() float[source]#

Return the scale factor that is needed to normalise a value of the given bit depth to the range 0..1.

Examples

>>> from colour_clf_io.values import BitDepth
>>> 255 / BitDepth.i8.scale_factor() == 1.0
True
>>> 0.5 * BitDepth.i8.scale_factor()
127.5
>>> 1023 / BitDepth.i10.scale_factor() == 1.0
True
>>> 1.0 / BitDepth.f16.scale_factor() == 1.0
True
Return type:

float

classmethod all() list[source]#

Return a list of all valid bit depth values.

Examples

>>> from colour_clf_io.values import BitDepth
>>> BitDepth.all()
['8i', '10i', '12i', '16i', '16f', '32f']
Return type:

list