Baker

Caution

API Docs are a work in progress, expect them to improve over time.

class Baker

In certain situations it is necessary to serialize transforms into a variety of application specific LUT formats. Note that not all file formats that may be read also support baking.

Usage Example: Bake a CSP sRGB viewer LUT

OCIO::ConstConfigRcPtr config = OCIO::Config::CreateFromEnv();
OCIO::BakerRcPtr baker = OCIO::Baker::Create();
baker->setConfig(config);
baker->setFormat("csp");
baker->setInputSpace("lnf");
baker->setShaperSpace("log");
baker->setTargetSpace("sRGB");
auto & metadata = baker->getFormatMetadata();
metadata.addChildElement(OCIO::METADATA_DESCRIPTION, "A first comment");
metadata.addChildElement(OCIO::METADATA_DESCRIPTION, "A second comment");
std::ostringstream out;
baker->bake(out); // fresh bread anyone!
std::cout << out.str();
BakerRcPtr createEditableCopy() const

Create a copy of this Baker.

ConstConfigRcPtr getConfig() const
void setConfig(const ConstConfigRcPtr &config)

Set the config to use.

const char *getFormat() const
void setFormat(const char *formatName)

Set the LUT output format.

const FormatMetadata &getFormatMetadata() const
FormatMetadata &getFormatMetadata()

Get editable optional format metadata. The metadata that will be used varies based on the capability of the given file format. Formats such as CSP, IridasCube, and ResolveCube will create comments in the file header using the value of any first-level children elements of the formatMetadata. The CLF/CTF formats will make use of the top-level “id” and “name” attributes and children elements “Description”, “InputDescriptor”, “OutputDescriptor”, and “Info”.

const char *getInputSpace() const
void setInputSpace(const char *inputSpace)

Set the input ColorSpace that the LUT will be applied to.

const char *getShaperSpace() const
void setShaperSpace(const char *shaperSpace)

Set an optional ColorSpace to be used to shape / transfer the input colorspace. This is mostly used to allocate an HDR luminance range into an LDR one. If a shaper space is not explicitly specified, and the file format supports one, the ColorSpace Allocation will be used (not implemented for all formats).

const char *getLooks() const
void setLooks(const char *looks)

Set the looks to be applied during baking. Looks is a potentially comma (or colon) delimited list of lookNames, where +/- prefixes are optionally allowed to denote forward/inverse look specification. (And forward is assumed in the absence of either).

const char *getTargetSpace() const
void setTargetSpace(const char *targetSpace)

Set the target device colorspace for the LUT.

int getShaperSize() const
void setShaperSize(int shapersize)

Override the default shaper LUT size. Default value is -1, which allows each format to use its own most appropriate size. For the CLF format, the default uses a half-domain LUT1D (which is ideal for scene-linear inputs).

int getCubeSize() const
void setCubeSize(int cubesize)

Override the default cube sample size. default: <format specific>

void bake(std::ostream &os) const

Bake the LUT into the output stream.

~Baker()

-[ Public Static Functions ]-

BakerRcPtr Create()

Create a new Baker.

int getNumFormats()

Get the number of LUT bakers.

const char *getFormatNameByIndex(int index)

Get the LUT baker format name at index, return empty string if an invalid index is specified.

const char *getFormatExtensionByIndex(int index)

Get the LUT baker format extension at index, return empty string if an invalid index is specified.

class PyOpenColorIO.Baker
class FormatIterator
bake(*args, **kwargs)

Overloaded function.

  1. bake(self: PyOpenColorIO.Baker, fileName: str) → None
  2. bake(self: PyOpenColorIO.Baker) → str
getConfig(self: PyOpenColorIO.Baker)PyOpenColorIO.Config
getCubeSize(self: PyOpenColorIO.Baker) → int
getFormat(self: PyOpenColorIO.Baker) → str
getFormatMetadata(*args, **kwargs)**

Overloaded function.

  1. getFormatMetadata(self: PyOpenColorIO.Baker)PyOpenColorIO.FormatMetadata
  2. getFormatMetadata(self: PyOpenColorIO.Baker)PyOpenColorIO.FormatMetadata
getFormats() → OpenColorIO_v2_0dev::PyIterator<std::shared_ptr<OpenColorIO_v2_0dev::Baker>, 0>
getInputSpace(self: PyOpenColorIO.Baker) → str
getLooks(self: PyOpenColorIO.Baker) → str
getShaperSize(self: PyOpenColorIO.Baker) → int
getShaperSpace(self: PyOpenColorIO.Baker) → str
getTargetSpace(self: PyOpenColorIO.Baker) → str
setConfig(self: PyOpenColorIO.Baker, config: PyOpenColorIO.Config) → None
setCubeSize(self: PyOpenColorIO.Baker, cubeSize: int) → None
setFormat(self: PyOpenColorIO.Baker, formatName: str) → None
setInputSpace(self: PyOpenColorIO.Baker, inputSpace: str) → None
setLooks(self: PyOpenColorIO.Baker, looks: str) → None
setShaperSize(self: PyOpenColorIO.Baker, shaperSize: int) → None
setShaperSpace(self: PyOpenColorIO.Baker, shaperSpace: str) → None
setTargetSpace(self: PyOpenColorIO.Baker, targetSpace: str) → None