CubeLut Class
An immutable color lookup table read from a .cube file, for ImageProcessingExtensions.ApplyLut: the color grades and film looks that video and photo tools export.
public sealed class CubeLutRemarks
The format is the one of the Adobe Cube LUT Specification 1.0. A file holds either a three-dimensional table (LUT_3D_SIZE n, from 2 to 256: n^3 output colors on a regular lattice of input colors) or a one-dimensional one (LUT_1D_SIZE n, from 2 to 65,536: n output values per channel), never both. Each data line holds three numbers, red, green and blue; the lines of a three-dimensional table run with red changing fastest, then green, then blue. DOMAIN_MIN and DOMAIN_MAX give the input range of each channel (0 to 1 by default); the LUT_1D_INPUT_RANGE and LUT_3D_INPUT_RANGE keywords of DaVinci Resolve give one range for the three channels. TITLE names the table. Lines that start with # are comments, blank lines are ignored, and every keyword comes before the data. Any other line is an error.
An input value is clamped to the domain of its channel, then located on the lattice: a one-dimensional table is interpolated linearly, a three-dimensional one as LutInterpolation says. The output values are used as they are written, without clamping: values outside [0, 1] reach floating-point images, and integer images clamp them to their sample range.
The table is held in single precision, outside the allocation limits of the images: a three-dimensional table of n points per axis takes 12 n^3 bytes (3.1 MiB for the common 65, 192 MiB for the largest, 256).
Properties
| Name | Description |
|---|---|
| IsThreeDimensional | Gets a value indicating whether the table is three-dimensional (LUT_3D_SIZE): each output color depends on the three input samples. A one-dimensional table maps each channel on its own. |
| Size | Gets the number of points of the table along each axis: the value of LUT_3D_SIZE or LUT_1D_SIZE. |
| Title | Gets the title of the table (the TITLE keyword), or null when the file has none. |
IsThreeDimensional
CubeLut.csSize
CubeLut.csTitle
CubeLut.csMethods
| Name | Description |
|---|---|
| Load(Stream) | Reads a table from a stream that holds a .cube file, from its current position to its end. The stream is not closed. |
| Load(string) | Reads a table from a .cube file. |
| Parse(string) | Reads a table from the text of a .cube file. |
Load overloads
Load(Stream)
CubeLut.csReads a table from a stream that holds a .cube file, from its current position to its end. The stream is not closed.
Parameters
streamStream- The stream.
Returns
CubeLut The table.
Exceptions
ArgumentNullExceptionstreamisnull.FormatException- The stream does not hold a valid
.cubefile. The message gives the line. IOException- The stream cannot be read.
Load(string)
CubeLut.csReads a table from a .cube file.
Parameters
pathstring- The path of the file.
Returns
CubeLut The table.
Exceptions
ArgumentNullExceptionpathisnull.FormatException- The file is not a valid
.cubefile. The message gives the line. IOException- The file cannot be read.
Parse(string)
CubeLut.csReads a table from the text of a .cube file.
Parameters
textstring- The text of the file.
Returns
CubeLut The table.
Exceptions
ArgumentNullExceptiontextisnull.FormatException- The text is not a valid
.cubefile. The message gives the line.