Applications Helpers

ColorSpaceMenuHelpers

PyOpenColorIO.ColorSpaceHelpers.AddColorSpace(config: PyOpenColorIO.PyOpenColorIO.Config, name: str, transformFilePath: str, categories: str = '', connectionColorSpaceName: str) → None

Add a new color space to the config instance. The output of the userTransform must be in the specified connectionColorSpace.

Note: If the config does not already use categories, we do not add them since that would make a big change to how existing color spaces show up in menus.

class PyOpenColorIO.ColorSpaceMenuParameters

Parameters controlling which color spaces appear in menus.

The ColorSpaceMenuHelper class is intended to be used by applications to get the list of items to show in color space menus.

The ColorSpaceMenuParameters class is used to configure the behavior as needed for any given menu. Here is the algorithm used to produce a list of “items” (or strings) that will appear in a menu:

  1. Use setRole to identify a role that controls a given menu. If the config has this role, then only that color space is returned. The name is set to the color space name, the UIName is presented as “<role name> (<color space name>)”. It may be useful for the application to then grey-out the menu or otherwise indicate to the user that the value for this menu is not user selectable since it was pre-determined by the config. If the config does not have that role, the algorithm continues to the remaining steps.

2) The IncludeColorSpaces, SearchReferenceSpaceType, and IncludeNamedTransforms parameters are used to identify a set of items from the config that are potential candidates for use in the menu, as follows: - IncludeColorSpaces: Set to true to include color spaces in the menu. - SearchReferenceSpaceType: Use this to control whether the menu should include all color spaces, only display color spaces, or only non-display color spaces. - IncludeNamedTransforms: Set to true to include named transforms in the menu.

3) The set of items from step 2 is then filtered in step 3 using the following parameters: - AppCategories: A list of strings specified by the application based on the purpose of the menu. For example, if the menu is used to select a color space for importing an image, the application might specify the ‘file-io’ category, whereas if it is to select a working color space, it might specify the ‘working-space’ category. Application developers should document what strings they are using for each menu so that config authors know what categories to use in their configs. Alternatively, an application could let advanced users customize the string to use for a given menu in the application. - Encodings: A list of strings used to further refine the items selected from the AppCategories. For example, an application might specify ‘working-space’ as the category and then specify ‘scene-linear’ as the encoding to only use items that have both of those properties (e.g., only select scene-linear working color spaces). - UserCategories: A list of strings specified by the end-user of the application. OCIO will check for these strings in an environment variable, or they may be passed in from the application. - TreatNoCategoryAsAny: By default, color spaces (or named transforms) that have no categories are handled as if they had any of the categories. Config authors that want to hide color spaces without categories should either put them in the inactiveColorSpaces list or add a category that will never be searched for (e.g., “invisible” or “hidden”). App developers may set this option to false to hide items without any categories.

Basically the intent is for the filtering to return the intersection of the app categories, encoding, and user categories. However, some fall-backs are in place to ensure that the filtering does not remove all menu items. Here is the detailed description:

3a) The items from step 2 are filtered to generate a list of appItems containing only the ones that contain at least one of the AppCategories strings in their “categories” property and one of the encodings in their “encoding” property. If this list is empty, an attempt is made to generate a non-empty appItems list by only filtering by AppCategories. If that is empty, an attempt is made to only filter by Encodings.

3b) The items from step 2 are filtered to generate a list of userItems containing only the ones that have at least one of the UserCategories strings in their “categories” property.

3c) If both appItems and userItems are non-empty, a list of resultItems will be generated as the intersection of those two lists.

3d) If the resultItems list is empty, the appList will be expanded by only filtering by AppCategories and not encodings. The resultItems will be formed again as the intersection of the appItems and userItems.

3e) If the resultItems is still empty, it will be set to just the appItems from step 3a.

3f) If the resultItems is still empty, it will be set to just the userItems.

3g) If the resultItems is still empty, the items are not filtered and all items from step 2 are returned. The rationale is that if step 2 has produced any items, it is not acceptable for step 3 to remove all of them. An application usually expects to have a non-zero number of items to display in the menu. However, if step 2 produces no items (e.g. the application requests only named transforms and the config has no named transform), then no items will be returned.

  1. If IncludeRoles is true, the items from step 3 are extended by including an item for each role. The name is set to the role name, the UIName is presented as “<role name> (<color

    space name>)”, and the family is set to “Roles”.

  2. If AddColorSpace has been used to add any additional items, these are appended to the final list.

ColorSpaceMenuParameters(*args, **kwargs)

Overloaded function.

  1. __init__(self: PyOpenColorIO.PyOpenColorIO.ColorSpaceMenuParameters, config: PyOpenColorIO.PyOpenColorIO.Config) -> None

  2. __init__(self: PyOpenColorIO.PyOpenColorIO.ColorSpaceMenuParameters, config: PyOpenColorIO.PyOpenColorIO.Config, role: str = ‘’, includeColorSpaces: bool = True, searchReferenceSpaceType: PyOpenColorIO.PyOpenColorIO.SearchReferenceSpaceType = <SearchReferenceSpaceType.SEARCH_REFERENCE_SPACE_ALL: 2>, includeNamedTransforms: bool = False, treatNoCategoryAsAny: bool = True, appCategories: str = ‘’, encodings: str = ‘’, userCategories: str = ‘’, includeRoles: bool = False) -> None

addColorSpace(colorSpace: str) → None

Add an additional color space (or named transform) to the menu.

Note that an additional color space could be: - an inactive color space, - an active color space not having at least one of the selected categories, - a newly created color space. Will throw when creating the menu if color space is not part of the config. Nothing is done if it is already part of the menu. It’s ok to call this multiple times with the same color space, it will only be added to the menu once. If a role name is passed in, the name in the menu will be the color space name the role points to.

clearAddedColorSpaces() → None
getAddedColorSpaces() → PyOpenColorIO.PyOpenColorIO.ColorSpaceMenuParameters.AddedColorSpaceIterator
getAppCategories() → str
getConfig() → PyOpenColorIO.PyOpenColorIO.Config
getEncodings() → str
getIncludeColorSpaces() → bool
getIncludeNamedTransforms() → bool
getIncludeRoles() → bool
getRole() → str
getSearchReferenceSpaceType() → PyOpenColorIO.PyOpenColorIO.SearchReferenceSpaceType

Can be used to restrict the search using the ReferenceSpaceType of the color spaces. It has no effect on roles and named transforms.

getTreatNoCategoryAsAny() → bool
getUserCategories() → str
setAppCategories(appCategories: str) → None

App categories is a comma separated list of categories. If appCategories is not NULL and not empty, all color spaces that have one of the categories will be part of the menu.

setConfig(config: PyOpenColorIO.PyOpenColorIO.Config) → None

Config is required to be able to create a ColorSpaceMenuHelper.

setEncodings(encodings: str) → None

Encodings is a comma separated list of encodings. When not empty, is retricting the search to color spaces that are using one of the encodings.

setIncludeColorSpaces(includeColorSpaces: bool = True) → None

Include all color spaces (or not) to ColorSpaceMenuHelper. Default is to include color spaces.

setIncludeNamedTransforms(includeNamedTransforms: bool = True) → None

Include all named transforms (or not) to ColorSpaceMenuHelper. Default is not to include named transforms.

setIncludeRoles(includeRoles: bool = True) → None

Include all roles (or not) to ColorSpaceMenuHelper. Default is not to include roles. Roles are added after color spaces with an single hierarchy level named “Roles”.

setRole(role: str) → None

If role is a valid role, other parameters are ignored and menu will contain only that role.

setSearchReferenceSpaceType(searchReferenceSpaceType: PyOpenColorIO.PyOpenColorIO.SearchReferenceSpaceType) → None
setTreatNoCategoryAsAny(treatNoCategoryAsAny: bool = True) → None

When searching for color spaces using app or user categories, treat color spaces or named transforms that have no categories as if they had any of the categories. Default is true.

setUserCategories(categories: str) → None

User categories is a comma separated list of categories. If OCIO_USER_CATEGORIES_ENVVAR env. variable is defined and not empty, this parameter is ignored and the value of the env. variable is used for user categories.

class PyOpenColorIO.ColorSpaceMenuHelper

Helper class to create menus for the content of a config.

Menu can list color spaces, roles, named transforms. Each entry has a name, a UI name, a description, and a family. Family can also be accessed as hierarchy levels; levels are created by splitting the family using the ‘family separator’. Hierarchy levels are meant to be used as sub-menus.

The UI name is what is intended to be put in application menus seen by the end-user. However, please note that the UI name is not guaranteed to remain stable between releases and so if applications need to save something it should be the ‘name’ rather than the ‘UI name’. Currently, the only difference between the ‘name’ and ‘UI name’ is for roles.

The overall ordering of items is: color spaces, named transforms, roles, and additional color spaces. The display color spaces will either come before or after the other color spaces based on where that block of spaces appears in the config. The order of items returned by the menu helper preserves the order of items in the config itself for each type of elements, thus preserving the intent of the config author. For example, if you call getName at idx and idx+1, the name returned at idx+1 will be from farther down in the config than the one at idx as long as both are of the same type. (An application may ask for only the items in one of those blocks if it wants to handle them separately.) If the application makes use of hierarchical menus, that will obviously impose a different order on what the user sees in the menu. Though even with hierarchical menus, applications should try to preserve config ordering (which is equivalent to index ordering) for items within the same sub-menu.

ColorSpaceMenuHelper(parameters: PyOpenColorIO.PyOpenColorIO.ColorSpaceMenuParameters) → None
getDescription(index: SupportsInt | SupportsIndex) → str
getFamily(index: SupportsInt | SupportsIndex) → str
getHierarchyLevels(index: SupportsInt | SupportsIndex) → PyOpenColorIO.PyOpenColorIO.ColorSpaceMenuHelper.ColorSpaceLevelIterator
getIndexFromName(name: str) → int

Get the index of the element of a given name. Return (size_t)-1 name if NULL or empty, or if no element with that name is found.

getIndexFromUIName(name: str) → int
getName(index: SupportsInt | SupportsIndex) → str

Get the color space (or role) name used in the config for this menu item. Will be empty if the index is out of range.

getNameFromUIName(name: str) → str

Get the color space name from the UI name.

getNumColorSpaces() → int

Access to the color spaces (or roles).

getUIName(index: SupportsInt | SupportsIndex) → str

Get the name to use in the menu UI. This might be different from the config name, for example in the case of roles. Will be empty if the index is out of range.

getUINameFromName(name: str) → str

Get the color space UI name from the name.

class PyOpenColorIO.ColorSpaceMenuHelper.ColorSpaceLevelIterator
self[arg0: SupportsInt | SupportsIndex] → str
iter(self) → PyOpenColorIO.PyOpenColorIO.ColorSpaceMenuHelper.ColorSpaceLevelIterator
len(self) → int
next(self) → str

ConfigCompatibilityHelpers

PyOpenColorIO.ConfigCompatibilityHelpers.CheckCompatibility(config: PyOpenColorIO.PyOpenColorIO.Config, compatibility: PyOpenColorIO.PyOpenColorIO.ConfigCompatibility) → bool

Check the config for compatibility with a specific requirement.

Returns false if the config is not compatible with the requirement identified by the given ConfigCompatibility value.

ConfigMergingHelpers

PyOpenColorIO.ConfigMergingHelpers.MergeConfigs(params: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters, baseConfig: PyOpenColorIO.PyOpenColorIO.Config, inputConfig: PyOpenColorIO.PyOpenColorIO.Config) → PyOpenColorIO.PyOpenColorIO.Config

Merge the input into the base config, using the supplied merge parameters.

Parameters:
  • params – ConfigMergingParameters controlling the merger.

  • params – The base config.

  • params – The input config to merge.

Returns:

The merged config object.

PyOpenColorIO.ConfigMergingHelpers.MergeColorSpace(params: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters, baseConfig: PyOpenColorIO.PyOpenColorIO.Config, colorspace: PyOpenColorIO.PyOpenColorIO.ColorSpace) → PyOpenColorIO.PyOpenColorIO.Config

Merge a single color space into the base config, using the supplied merge parameters.

Note that the AdjustInputReferenceSpace merge parameter will be ignored and set to false. To use automatic reference space conversion, add the color space to an input config that has the necessary interchange role set.

Parameters:
  • params – ConfigMergingParameters controlling the merger.

  • params – The base config.

  • params – The input color space to merge.

Returns:

The merged config object.

class PyOpenColorIO.ConfigMergingParameters

The ConfigMergingParameters class holds the options that control how a merge is done.

In terms of OCIOM file, it represent one of the merges in an OCIOM file.

static Create() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters
STRATEGY_BASE_ONLY = <MergeStrategies.STRATEGY_BASE_ONLY: 3>
STRATEGY_INPUT_ONLY = <MergeStrategies.STRATEGY_INPUT_ONLY: 2>
STRATEGY_PREFER_BASE = <MergeStrategies.STRATEGY_PREFER_BASE: 1>
STRATEGY_PREFER_INPUT = <MergeStrategies.STRATEGY_PREFER_INPUT: 0>
STRATEGY_REMOVE = <MergeStrategies.STRATEGY_REMOVE: 4>
STRATEGY_UNSPECIFIED = <MergeStrategies.STRATEGY_UNSPECIFIED: 5>
ConfigMergingParameters(*args, **kwargs)
addEnvironmentVar(name: str, defaultValue: str) → None

Override a context variable in the merged config.

addSearchPath(path: str) → None
getActiveDisplays() → str
getActiveViews() → str
getBaseConfigName() → str
getBaseFamilyPrefix() → str
getColorspaces() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies
getDefaultStrategy() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies
getDescription() → str
getDisplayViews() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies
getEnvironmentVar(index: SupportsInt | SupportsIndex) → str
getEnvironmentVarValue(index: SupportsInt | SupportsIndex) → str
getFileRules() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies
getInactiveColorSpaces() → str
getInputConfigName() → str
getInputFamilyPrefix() → str
getLooks() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies
getName() → str
getNamedTransforms() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies
getNumEnvironmentVars() → int

Get the number of context variable overrides.

getOutputName() → str
getRoles() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies
getSearchPath() → str
getViewTransforms() → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies
isAdjustInputReferenceSpace() → bool
isAvoidDuplicates() → bool
isErrorOnConflict() → bool
isInputFirst() → bool
setActiveDisplays(displays: str) → None

Override the active_displays of the merged config.

setActiveViews(views: str) → None

Override the active_views of the merged config.

setAdjustInputReferenceSpace(enabled: bool) → None

If true, the reference spaces of the base and input config are compared and color spaces from the input config will be adjusted to use the reference space of the base. If the interchange roles are not set, heuristics will be used to try and determine the reference space. Default = true.

setAvoidDuplicates(enabled: bool) → None

If true, a color space from the input config is compared against those of the base config. If it is mathematically equivalent, it is not added. Instead, its name and aliases are added to the original color space. Default = true.

setBaseConfigName(baseConfig: str) → None

Set the file name of the base config. This is used along with the search path of the ConfigMerger object.

setBaseFamilyPrefix(prefix: str) → None

Set a prefix to add to the family of base config items. (It must use ‘/’ as the separator and will be replaced by the actual family separator of the config.)

setColorspaces(strategy: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies) → None

Set the merge strategy for the color spaces section. This includes colorspaces, display_colorspaces, environment, search_path, family_separator, and inactive_colorspaces.

setDefaultStrategy(strategy: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies) → None

Set the default strategy. This will be used if the strategy for a given config section is not set, and will be used for basic attributes such as the config description. Default = STRATEGY_PREFER_INPUT.

setDescription(mergedConfigDesc: str) → None

Override the description of the merged config.

setDisplayViews(strategy: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies) → None

Set the merge strategy for the displays/views section. This includes shared_views, displays, viewing_rules, virtual_display, active_display, and active_views.

setErrorOnConflict(enabled: bool) → None

If true, throw an exception rather than log a warning when a conflict is detected. Default = false.

setFileRules(strategy: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies) → None

Set the merge strategy for the file_rules section.

setInactiveColorSpaces(colorspaces: str) → None

Override the inactive_colorspaces of the merged config.

setInputConfigName(inputConfig: str) → None

Set the file name of the input config. This is used along with the search path of the ConfigMerger object.

setInputFamilyPrefix(prefix: str) → None

Set a prefix to add to the family of input config items. (It must use ‘/’ as the separator and will be replaced by the actual family separator of the config.)

setInputFirst(enabled: bool) → None

If true, items from the input config will be higher in the file than those of the base config. Default = true.

setLooks(strategy: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies) → None

Set the merge strategy for the looks section.

setName(mergedConfigName: str) → None

Override the name of the merged config.

setNamedTransforms(strategy: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies) → None

Set the merge strategy for the named_transforms section.

setOutputName(outputName: str) → None

Set a name to use for this merger. This may be used as the input or base config name in subsequent mergers.

setRoles(strategy: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies) → None

Set the merge strategy for the roles section.

setSearchPath(path: str) → None

Override the search_path of the merged config.

setViewTransforms(strategy: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters.MergeStrategies) → None

Set the merge strategy for the view_transforms section. This includes the view_transforms and default_view_transform.

class PyOpenColorIO.ConfigMergingParameters.MergeStrategies

Members:

STRATEGY_PREFER_INPUT : Combine elements of the base and input configs, with the input taking priority.

STRATEGY_PREFER_BASE : Combine elements of the base and input configs, with the base taking priority.

STRATEGY_INPUT_ONLY : Use only the input elements for that section of the config.

STRATEGY_BASE_ONLY : Use only the base elements for that section of the config.

STRATEGY_REMOVE : The elements in the input config are removed from the base config. (If the names match, the item is removed, even if the content is not identical.)

STRATEGY_UNSPECIFIED : Strategy has not been set yet.

STRATEGY_BASE_ONLY = <MergeStrategies.STRATEGY_BASE_ONLY: 3>
STRATEGY_INPUT_ONLY = <MergeStrategies.STRATEGY_INPUT_ONLY: 2>
STRATEGY_PREFER_BASE = <MergeStrategies.STRATEGY_PREFER_BASE: 1>
STRATEGY_PREFER_INPUT = <MergeStrategies.STRATEGY_PREFER_INPUT: 0>
STRATEGY_REMOVE = <MergeStrategies.STRATEGY_REMOVE: 4>
STRATEGY_UNSPECIFIED = <MergeStrategies.STRATEGY_UNSPECIFIED: 5>
property value
class PyOpenColorIO.ConfigMerger

The ConfigMerger class is the controller for the merging process.

It may be read from or serialized to an OCIOM file.

It is controlling the search_path to find the base and input config, and the merge parameters.

It contains an instance of ConfigMergingParameters for each merge present under the “merge” section.

For example, consider the following OCIOM file contents:

ociom_version: 1.0 search_path: - /usr/local/configs - . merge: Merge_ADD_THIS: […] Merge_ADD_THAT: […]

For this OCIOM, there would be two instances of ConfigMergingParameters. One for the merge with output name “Merge_ADD_THIS” and one for “Merge_ADD_THAT”.

Where the […] sections have the following structure:

Merge_ADD_THIS: base: base.ocio input: input.ocio options: input_family_prefix: “” base_family_prefix: “” input_first: true error_on_conflict: false default_strategy: PreferInput avoid_duplicates: true adjust_input_reference_space: true overrides: name: “” description: “” search_path: “” environment: {} active_displays: [] active_views: [] inactive_colorspaces: [] params: roles: strategy: PreferBase file_rules: strategy: PreferInput display-views: strategy: InputOnly view_transforms: strategy: InputOnly looks: strategy: BaseOnly colorspaces: strategy: PreferInput named_transform: strategy: Remove

The indentation is significant and must be as shown. Default items may be omitted.

static Create() → PyOpenColorIO.PyOpenColorIO.ConfigMerger
static CreateFromFile(filepath: str) → PyOpenColorIO.PyOpenColorIO.ConfigMerger
ConfigMerger(*args, **kwargs)
addParams(params: PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters) → None
addSearchPath(path: str) → None

Add a single path to the search paths.

getMajorVersion() → int
getMergedConfig(*args, **kwargs)

Overloaded function.

  1. getMergedConfig(self: PyOpenColorIO.PyOpenColorIO.ConfigMerger) -> PyOpenColorIO.PyOpenColorIO.Config

Get the final merged config.

  1. getMergedConfig(self: PyOpenColorIO.PyOpenColorIO.ConfigMerger, index: typing.SupportsInt | typing.SupportsIndex) -> PyOpenColorIO.PyOpenColorIO.Config

Get the final merged config.

getMinorVersion() → int
getNumConfigMergingParameters() → int
getNumMergedConfigs() → int
getNumSearchPaths() → int

Get the number of search paths.

getParams(index: SupportsInt | SupportsIndex) → PyOpenColorIO.PyOpenColorIO.ConfigMergingParameters

Get the parameters for one of the merges. Returns null if index is out of range.

getSearchPath(index: SupportsInt | SupportsIndex) → str
getWorkingDir() → str
mergeConfigs() → PyOpenColorIO.PyOpenColorIO.ConfigMerger

Execute the merge(s) based on the merger object.

Execute the merge(s) based on the merger object that was previously populated by using ConfigMerger::CreateFromFile or created from scratch by using ConfigMerger::Create() and programmatically configuring it.

Returns:

a merger object (call getMergedConfig to obtain the result)

serialize() → str

Serialize to the OCIOM file format.

setSearchPath(path: str) → None

These search paths are used to locate the input and base config. Set the entire search path. The ‘:’ character is used to separate paths.

setVersion(major: SupportsInt | SupportsIndex, minor: SupportsInt | SupportsIndex) → None

Set the version of the OCIOM file format.

setWorkingDir(dirname: str) → None

Set the home directory used to resolve relative search paths.

The working directory defaults to the location of the OCIOM file. It is used to convert any relative paths to absolute. If no search paths have been set, the working directory will be used as the fallback search path.

DisplayViewHelpers

PyOpenColorIO.DisplayViewHelpers.GetProcessor(config: PyOpenColorIO.PyOpenColorIO.Config, context: PyOpenColorIO.PyOpenColorIO.Context = None, workingSpaceName: str, displayName: str, viewName: str, channelView: PyOpenColorIO.PyOpenColorIO.MatrixTransform = None, direction: PyOpenColorIO.PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) → PyOpenColorIO.PyOpenColorIO.Processor

Get the processor from the working color space to (display, view) pair (forward) or (display, view) pair to working (inverse). The working color space name could be a role name or a color space name. ChannelView can be empty. If not already present, each of these functions adds ExposureContrastTransforms to enable changing exposure, contrast, and gamma after the processor has been created using dynamic properties.

PyOpenColorIO.DisplayViewHelpers.GetIdentityProcessor(config: PyOpenColorIO.PyOpenColorIO.Config) → PyOpenColorIO.PyOpenColorIO.Processor

Get an identity processor containing only the ExposureContrastTransforms.

PyOpenColorIO.DisplayViewHelpers.AddDisplayView(config: PyOpenColorIO.PyOpenColorIO.Config, displayName: str, viewName: str, lookName: str = '', colorSpaceName: str = '', colorSpaceFamily: str = '', colorSpaceDescription: str = '', colorSpaceCategories: str = '', transformFilePath: str, connectionColorSpaceName: str) → None

Add a new (display, view) pair and the new color space to a configuration instance. The input to the userTransform must be in the specified connectionColorSpace.

PyOpenColorIO.DisplayViewHelpers.RemoveDisplayView(config: PyOpenColorIO.PyOpenColorIO.Config, displayName: str, viewName: str) → None

Remove a (display, view) pair including the associated color space (only if not used). Note that the view is always removed but the display is only removed if empty.

LegacyViewingPipeline

class PyOpenColorIO.LegacyViewingPipeline

Whereas the DisplayViewTransform simply applies a specific view from an OCIO display, the LegacyViewingPipeline provides an example of a complete viewing pipeline of the sort that could be used to implement a viewport in a typical application. It therefore adds, around the DisplayViewTransform, various optional color correction steps and RGBA channel view swizzling. The direction of the DisplayViewTranform is used as the direction of the pipeline. Note: The LegacyViewingPipeline class provides the same functionality as the OCIO v1 DisplayTransform.

Legacy viewing pipeline: - Start in display transform input color space. - If linearCC is provided: - Go to scene_linear colorspace. - Apply linearCC transform.

  • If colorTimingCC is provided:

  • Go to color_timing colorspace.

  • Apply colorTimingCC transform.

  • Apply looks (from display transform or from looks override).

  • Go to first look color space.

  • Apply first look transform.

  • Iterate for all looks.

  • Apply channelView transform.

  • Apply display transform (without looks).

  • Apply displayCC. Note that looks are applied even if the display transform involves data color spaces.

LegacyViewingPipeline() → None
getChannelView() → PyOpenColorIO.PyOpenColorIO.Transform
getColorTimingCC() → PyOpenColorIO.PyOpenColorIO.Transform
getDisplayCC() → PyOpenColorIO.PyOpenColorIO.Transform
getDisplayViewTransform() → PyOpenColorIO.PyOpenColorIO.DisplayViewTransform
getLinearCC() → PyOpenColorIO.PyOpenColorIO.Transform
getLooksOverride() → str
getLooksOverrideEnabled() → bool
getProcessor(config: PyOpenColorIO.PyOpenColorIO.Config, context: PyOpenColorIO.PyOpenColorIO.Context = None) → PyOpenColorIO.PyOpenColorIO.Processor
setChannelView(arg0: PyOpenColorIO.PyOpenColorIO.Transform) → None
setColorTimingCC(arg0: PyOpenColorIO.PyOpenColorIO.Transform) → None
setDisplayCC(arg0: PyOpenColorIO.PyOpenColorIO.Transform) → None
setDisplayViewTransform(arg0: PyOpenColorIO.PyOpenColorIO.DisplayViewTransform) → None
setLinearCC(arg0: PyOpenColorIO.PyOpenColorIO.Transform) → None
setLooksOverride(looks: str) → None

A user can optionally override the looks that are, by default, used with the expected display / view combination. A common use case for this functionality is in an image viewing app, where per-shot looks are supported. If for some reason a per-shot look is not defined for the current Context, the Config::getProcessor fcn will not succeed by default. Thus, with this mechanism the viewing app could override to looks = “”, and this will allow image display to continue (though hopefully) the interface would reflect this fallback option.

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).

setLooksOverrideEnabled(arg0: bool) → None

Specify whether the lookOverride should be used, or not. This is a separate flag, as it’s often useful to override “looks” to an empty string.

MixingHelpers

class PyOpenColorIO.MixingSlider

The MixingSlider and MixingColorSpaceManager classes are to help applications implement correct color pickers. The term “color mixing” is used here to describe what is done in a typical application “color picker” user interface.

A user may want to mix colors in different color spaces. The two most common mixing space options are a scene-linear working space or the display space.

Since scene-linear color spaces are not perceptually uniform, it is necessary to compensate UI widgets such as sliders. For example, it is nice if mid-gray falls near the center of mixing controls rather than way over near the black end. This may be done by using a mapping from linear into an approximately perceptually uniform space.

Also note that a color picking/mixing UI may want to present a given color space in several different encodings. The most common two encodings for color mixing are RGB and HSV.

Note that these helpers anticipate that a user may want to mix colors using values that extend outside the typical [0,1] domain.

MixingSlider(*args, **kwargs)
getSliderMaxEdge() → float

Maximum edge of a UI slider for conversion to mixing space.

getSliderMinEdge() → float

Minimum edge of a UI slider for conversion to mixing space.

mixingToSlider(mixingUnits: SupportsFloat | SupportsIndex) → float

Convert from mixing space units to distance along the slider.

setSliderMaxEdge(arg0: SupportsFloat | SupportsIndex) → None

Set the maximum edge of a UI slider for conversion to mixing space.

setSliderMinEdge(arg0: SupportsFloat | SupportsIndex) → None

Set the minimum edge of a UI slider for conversion to mixing space.

sliderToMixing(sliderUnits: SupportsFloat | SupportsIndex) → float

Convert from units in distance along the slider to mixing space units.

class PyOpenColorIO.MixingColorSpaceManager

Used to mix (or pick/choose) colors.

MixingColorSpaceManager(config: PyOpenColorIO.PyOpenColorIO.Config) → None
getMixingEncodings() → PyOpenColorIO.PyOpenColorIO.MixingColorSpaceManager.MixingEncodingIterator
getMixingSpaces() → PyOpenColorIO.PyOpenColorIO.MixingColorSpaceManager.MixingSpaceIterator
getProcessor(workingSpaceName: str, displayName: str, viewName: str, direction: PyOpenColorIO.PyOpenColorIO.TransformDirection = <TransformDirection.TRANSFORM_DIR_FORWARD: 0>) → PyOpenColorIO.PyOpenColorIO.Processor
getSelectedMixingEncodingIdx() → int
getSelectedMixingSpaceIdx() → int
getSlider(*args, **kwargs)

Overloaded function.

  1. getSlider(self: PyOpenColorIO.PyOpenColorIO.MixingColorSpaceManager) -> PyOpenColorIO.PyOpenColorIO.MixingSlider

  2. getSlider(self: PyOpenColorIO.PyOpenColorIO.MixingColorSpaceManager, sliderMixingMinEdge: typing.SupportsFloat | typing.SupportsIndex, sliderMixingMaxEdge: typing.SupportsFloat | typing.SupportsIndex) -> PyOpenColorIO.PyOpenColorIO.MixingSlider

isPerceptuallyUniform() → bool
refresh(config: PyOpenColorIO.PyOpenColorIO.Config) → None

Refresh the instance (i.e. needed following a configuration change for example).

setSelectedMixingEncoding(mixingEncoding: str) → None
setSelectedMixingEncodingIdx(arg0: SupportsInt | SupportsIndex) → None
setSelectedMixingSpace(mixingSpace: str) → None
setSelectedMixingSpaceIdx(arg0: SupportsInt | SupportsIndex) → None
class PyOpenColorIO.MixingColorSpaceManager.MixingSpaceIterator
self[arg0: SupportsInt | SupportsIndex] → str
iter(self) → PyOpenColorIO.PyOpenColorIO.MixingColorSpaceManager.MixingSpaceIterator
len(self) → int
next(self) → str
class PyOpenColorIO.MixingColorSpaceManager.MixingEncodingIterator
self[arg0: SupportsInt | SupportsIndex] → str
iter(self) → PyOpenColorIO.PyOpenColorIO.MixingColorSpaceManager.MixingEncodingIterator
len(self) → int
next(self) → str