colour.gamma_function#
- colour.gamma_function(a: ArrayLike, exponent: ArrayLike = 1, negative_number_handling: Literal['Clamp', 'Indeterminate', 'Mirror', 'Preserve'] | str = 'Indeterminate') NDArrayFloat[source]#
Apply a gamma encoding or decoding transformation to the specified array.
- Parameters:
a (ArrayLike) – Array to encode or decode.
exponent (ArrayLike) – Encoding or decoding exponent.
negative_number_handling (Literal['Clamp', 'Indeterminate', 'Mirror', 'Preserve'] | str) –
Behaviour for
anegative numbers and the definition return value:Indeterminate: The behaviour will be indeterminate and the definition return value might contain nans.
Mirror: The definition return value will be mirrored around the abscissa and ordinate axes, i.e., Blackmagic Design: Davinci Resolve behaviour.
Preserve: The definition will preserve any negative number in
a, i.e., The Foundry Nuke behaviour.Clamp: The definition will clamp any negative number in
ato 0.
- Returns:
Encoded or decoded array.
- Return type:
Examples
>>> gamma_function(0.18, 2.2) 0.0229932... >>> gamma_function(-0.18, 2.0) 0.0323999... >>> gamma_function(-0.18, 2.2) nan >>> gamma_function(-0.18, 2.2, "Mirror") -0.0229932... >>> gamma_function(-0.18, 2.2, "Preserve") -0.1... >>> gamma_function(-0.18, 2.2, "Clamp") 0.0