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 ¶
- getDisplay() str ¶
- getFormat() str ¶
- getFormatMetadata() PyOpenColorIO.FormatMetadata ¶
- static getFormats() PyOpenColorIO.Baker.FormatIterator ¶
- getInputSpace() str ¶
- getLooks() str ¶
- getShaperSize() int ¶
- getShaperSpace() str ¶
- getTargetSpace() str ¶
- getView() str ¶
- setConfig(config: PyOpenColorIO.Config) None ¶
Set the config to use.
- setCubeSize(cubeSize: int) None ¶
Override the main LUT (3d or 1d) sample size. Default value is -1, which allows each format to use its own most appropriate size.
- setDisplayView(display: str, view: str) None ¶
Set the display and view to apply during the baking. Must not be used if setTargetSpace is used.
- 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 shape the incoming values of the LUT. When baking 3DLUT, this will correspond to the 1D shaper used to normalise incoming values to the unit range. When baking 1D LUT, this will be used to determine the input range of the LUT.
- setTargetSpace(targetSpace: str) None ¶
Set the target (i.e., output) color space for the LUT. Must not be used if setDisplayView is used.
-
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();
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 or NamedTransform to shape the incoming values of the LUT. When baking 3DLUT, this will correspond to the 1D shaper used to normalise incoming values to the unit range. When baking 1D LUT, this will be used to determine the input range of the LUT.
-
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 (i.e., output) color space for the LUT. Must not be used if setDisplayView is used.
-
const char *getDisplay() const¶
-
const char *getView() const¶
-
void setDisplayView(const char *display, const char *view)¶
Set the display and view to apply during the baking. Must not be used if setTargetSpace is used.
-
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 main LUT (3d or 1d) sample size. Default value is -1, which allows each format to use its own most appropriate size.
-
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 createEditableCopy() const¶