colour.io.LUT_to_LUT#
- colour.io.LUT_to_LUT(LUT: AbstractLUT, cls: Type[AbstractLUT], force_conversion: bool = False, **kwargs: Any) AbstractLUT[source]#
Convert a specified LUT to the specified
clsclass instance.This function facilitates conversion between different LUT class types, including LUT1D, LUT3x1D, and LUT3D instances. Some conversions may be destructive and require explicit force conversion.
- Parameters:
LUT (AbstractLUT) – LUT to convert.
cls (Type[AbstractLUT]) – Target LUT class type for conversion.
force_conversion (bool) – Whether to force the conversion if it would be destructive.
channel_weights – Channel weights in case of a downcast from a
LUT3x1DorLUT3Dclass instance.interpolator – Interpolator class type to use as interpolating function.
interpolator_kwargs – Arguments to use when instantiating the interpolating function.
size – Expected table size in case of an upcast to or a downcast from a
LUT3Dclass instance.kwargs (Any)
- Returns:
Converted LUT class instance.
- Return type:
Warning
Some conversions are destructive and raise a
ValueErrorexception by default.- Raises:
ValueError – If the conversion is destructive.
- Parameters:
- Return type:
AbstractLUT
Examples
>>> print(LUT_to_LUT(LUT1D(), LUT3D, force_conversion=True)) LUT3D - Unity 10 - Converted 1D to 3D ------------------------------------- Dimensions : 3 Domain : [[0. 0. 0.] [1. 1. 1.]] Size : (33, 33, 33, 3) >>> print(LUT_to_LUT(LUT3x1D(), LUT1D, force_conversion=True)) LUT1D - Unity 10 - Converted 3x1D to 1D --------------------------------------- Dimensions : 1 Domain : [0. 1.] Size : (10,) >>> print(LUT_to_LUT(LUT3D(), LUT1D, force_conversion=True)) LUT1D - Unity 33 - Converted 3D to 1D ------------------------------------- Dimensions : 1 Domain : [0. 1.] Size : (10,)