# LUT¶

class Draft.LUT

The Draft.LUT class contains Draft’s methods for working with Color Look-Up Tables (LUT). It contains two types of functions: Static functions, and Member functions. Static functions can be invoked without an instance (by calling Draft.LUT.<function name>), whereas Member functions must be invoked from an instance of a Draft.LUT object (by calling <someLUT>.<function name>).

The Static functions are used to create new instances of the Draft.LUT class, whereas the Member functions are used to work with existing instances of the Draft.LUT. The sample code snippets should clarify this distinction function in case you are unsure.

Raises an exception This class cannot be instantiated from Python

Apply((LUT)arg1, (Image)image) → None :

Transform a Draft.Image‘s color using this LUT.

Arguments:

image
The image to transform. The image will be transformed in-place.

Usage:

image = Draft.Image.ReadFromFile( '//path/to/some/image/file.png' )
lut = Draft.LUT.CreateSRGB()
lut.Apply( image )

static ClearOCIOCaches() → None :

Flush OCIO’s cached contents of LUTs on disk, intermediate results, etc.

New in version 1.2.

Arguments: (none)

Usage:

Draft.LUT.ClearOCIOCaches()


Note

Calling this is normally not necessary.

static CreateASCCDL((object)slope, (object)offset, (object)power[, (float)saturation=1]) → LUT :

Return a new linear-to-ASC-CDL LUT.

New in version 1.2.

Arguments:

slope
Three float values greater than or equal to 0 indicating the slope correction for the R, G, B channels. For example: [ 1.2, 0, 3.4 ].
offset
Three float values indicating the offset correction for the R, G, B channels. For example: [ -0.6, 0.2, 0 ].
power
Three float values strictly greater than 0 indicating the power correction for the R, G, B channels. For example: [ 1.1, 2, 3 ].
saturation
Optional. A float value greater than or equal to 0 indicating the saturation to apply. Defaults to 1.

Usage:

lut = Draft.LUT.CreateASCCDL( [1, 0, 3.4], [-0.6, 0.2, 0], [1.1, 2, 3], 1 )


Note

Draft does not compute the inverse of an ASC CDL LUT, and so calling Inverse() on one will throw a runtime error.

static CreateAlexaV3LogC() → LUT :

Return a new linear-to-ALEXA V3 Log C LUT.

Arguments: (none)

Usage:

alexaLut = Draft.LUT.CreateAlexaV3LogC()

static CreateCineon([(float)blackLevel=95[, (float)whiteLevel=685]]) → LUT :

Return a new linear-to-Cineon LUT.

Arguments:

blackLevel
Optional. An integer in the range [0..1023] indicating the black level. (Default is 95.)
whiteLevel
Optional. An integer in the range [0..1023] indicating the white level. (Default is 685.)

Usage:

cineonLut = Draft.LUT.CreateCineon()

static CreateGamma((float)gamma) → LUT :

Return a new linear-to-Gamma LUT.

Arguments:

gamma
A float value indicating the gamma to apply.

Usage:

gammaLut = Draft.LUT.CreateGamma( 2.2 )

static CreateOCIOProcessor((str)colorSpaceIn, (str)colorSpaceOut) → LUT :

Return a new OCIO LUT for converting images from colorSpaceIn to colorSpaceOut. (Note: Can also use role alias names from config.ocio.)

New in version 1.2.

Arguments:

colorSpaceIn
the colorspace the input images will be in.
colorSpaceOut
the desired colorspace for the processed images.

Usage:

ocioLUT = Draft.LUT.CreateOCIOProcessor( 'linear', 'Cineon' )

static CreateOCIOProcessorFromFile((str)filename) → LUT :

Return a new OCIO LUT based on the specified file.

New in version 1.2.

Arguments:

filename
name of the LUT file (including the path, either absolute, or relative to the search paths in config.ocio).

Usage:

lut = Draft.LUT.CreateOCIOProcessorFromFile( '//path/to/LUTfile.ext' )


Note

For a list of supported LUT file types, see: http://opencolorio.org/FAQ.html#what-lut-formats-are-supported.

static CreateRec709() → LUT :

Return a new linear-to-Rec. 709 LUT.

Arguments: (none)

Usage:

rec709Lut = Draft.LUT.CreateRec709()

static CreateSRGB() → LUT :

Return a new linear-to-sRGB LUT.

Arguments: (none)

Usage:

srgbLut = Draft.LUT.CreateSRGB()

Inverse((LUT)arg1) → LUT :

Return a new LUT that performs the inverse operation of this LUT.

Arguments: (none)

Usage:

cineonLut = Draft.LUT.CreateCineon()
inverseCineonLut = cineonLut.Inverse()

static SetOCIOConfig([(unicode)path='']) → None :

Initialize OCIO to use the config.ocio file specified by path. If no path is supplied, Draft checks the OCIO environment variable, then configurations distributed with Draft, and finally searches PATH for a directory containing a config.ocio file.

New in version 1.2.

Arguments:

path
path/to/config.ocio (optional)

Usage:

Draft.LUT.SetOCIOConfig( '//path/to/some/config.ocio' )