Baker¶
-
class
PyOpenColorIO.
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(:ref:`OCIO::METADATA_DESCRIPTION`, "A first comment"); metadata.addChildElement(:ref:`OCIO::METADATA_DESCRIPTION`, "A second comment"); std::ostringstream out; baker->bake(out); // fresh bread anyone! std::cout << out.str();
-
Baker
(*args, **kwargs)¶ Overloaded function.
__init__(self: PyOpenColorIO.Baker) -> None
Create a new Baker.
__init__(self: PyOpenColorIO.Baker, config: PyOpenColorIO.Config, format: str, inputSpace: str, targetSpace: str, looks: str = ‘’, cubeSize: int = -1, shaperSpace: str = ‘’, shaperSize: int = -1) -> None
Create a new Baker.
-
bake
(*args, **kwargs)¶ Overloaded function.
bake(self: PyOpenColorIO.Baker, fileName: str) -> None
bake(self: PyOpenColorIO.Baker) -> str
Bake the LUT into the output stream.
-
getConfig
() → PyOpenColorIO.Config¶
-
getCubeSize
() → int¶
-
getFormat
() → str¶
-
getFormatMetadata
() → PyOpenColorIO.FormatMetadata¶
-
static
getFormats
() → PyOpenColorIO.Baker.FormatIterator¶
-
getInputSpace
() → str¶
-
getLooks
() → str¶
-
getShaperSize
() → int¶
-
getShaperSpace
() → str¶
-
getTargetSpace
() → str¶
-
setConfig
(config: PyOpenColorIO.Config) → None¶ Set the config to use.
-
setCubeSize
(cubeSize: int) → None¶ Override the default cube sample size. default: <format specific>
-
setFormat
(formatName: str) → None¶ Set the LUT output format.
-
setInputSpace
(inputSpace: str) → None¶ Set the input ColorSpace that the LUT will be applied to.
-
setLooks
(looks: str) → None¶ 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).
-
setShaperSize
(shaperSize: int) → None¶ 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).
-
setShaperSpace
(shaperSpace: str) → None¶ 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).
-
setTargetSpace
(targetSpace: str) → None¶ Set the target device colorspace for the LUT.
-
-
class
OpenColorIO_v2_1dev
::
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();
Public Functions
-
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
()¶ Do not use (needed only for pybind11).
Public Static Functions
-
static BakerRcPtr
Create
()¶ Create a new Baker.
-
static int
getNumFormats
()¶ Get the number of LUT bakers.
-
static const char *
getFormatNameByIndex
(int index)¶ Get the LUT baker format name at index, return empty string if an invalid index is specified.
-
static const char *
getFormatExtensionByIndex
(int index)¶ Get the LUT baker format extension at index, return empty string if an invalid index is specified.
-
BakerRcPtr