Making Other Colorspace Conversions

You can also convert elements from Nuke’s native color space to other color spaces more appropriate to a given process or intended display device. For conversions such as this, use Nuke’s Colorspace node, which supports RGB, HSV, YUV, CIE, and CMS formats (and various sub-formats).

To Convert an Element in Nuke’s Native Color Space into Another Color Space

1.   Click Color > Colorspace to insert a Colorspace node into the appropriate place in your script.
2.   In the Colorspace properties panel, set the rightmost dropdown menu in the output controls to the appropriate standard.
3.   Set the dropdown menu in the middle of the output controls to the appropriate standard.
4.   Set the leftmost dropdown menu in the output controls to the color space of your choice.
5.   If you wish to reverse this conversion later in the script:

Copy the Colorspace node and insert it at the appropriate point in your script.

Set the output controls to sRGB, D55, and RGB.

Set the input controls to match the values you entered in steps 2, 3, and 4 above.

6.   If you wish write out the element in the new color space:

Double-click on the element’s Write node.

In the Write properties panel, set the colorspace dropdown menu to linear. This halts the automatic conversion and lets the one you create above have priority.

Converting Color Spaces with the OCIOColorSpace Node

Much like the ColorSpace node, you can use the OCIOColorSpace node for converting an image sequence from one colorspace to another.

Conversions with the OCIOColorSpace node are based on the OpenColorIO library (for more information, see https://opencolorio.org). Using OCIOColorSpace is pretty simple:

1.   Select Color > OCIO > OCIO ColorSpace and connect it to your image sequence.
2.   Select the channel or layer you want the conversion to affect using the channels controls.
3.   In the input dropdown, select the colorspace of your input image.
4.   In the output dropdown, select the colorspace you want to convert the image to.

For more information on the OCIOColorSpace node, and other nodes based on the OpenColorIO library, see Color Nodes for more information.

Note:  Nuke is bundled with a pre-compiled version of the OpenColorIO library and a suite of OCIO nodes. If you already have a pre-built version of the OCIO library on your system and your environment is not set up correctly for Nuke, you may encounter problems. For OCIO to work correctly, Nuke requires the compiled versions of PyOpenColorIO and libOpenColorIO to match. To override Nuke's pre-packaged version with your own custom version, follow the steps below:

Linux:
Manually replace the Nuke packaged versions of libOpenColorIO.so and PyOpenColorIO.so with your custom versions of these files. These can be found in the <NukeInstall> and <NukeInstall>/plugins directories respectively.

Mac:
Set your NUKE_PATH to the location of PyOpenColorIO.so and your DYLD_LIBRARY_PATH to the location of OpenColorIO.so. For example:
export NUKE_PATH="/myOCIOLibraryLocation/"
export DYLD_LIBRARY_PATH="/myOCIOLibraryLocation/"

Windows:
Both OpenColorIO.dll and PyOpenColorIO.pyd must be in the same directory. You then need to set your NUKE_PATH to this directory. For example:
set NUKE_PATH=\myOCIOLibraryLocation\

All Platforms:
In addition to the steps above, you need to set the OCIO environment variable to point to your OCIO configuration file. This overrides the configuration file specified in Nuke’s preferences (see Setting Preferences). For example:
export OCIO="/myOCIOConfigLocation/config.ocio"
The OCIO nodes in Nuke are compiled against a specific version of the OCIO libraries (for the current version, see Third-Party Libraries and Fonts for Nuke 15.0v1). If you’re using your own custom libraries, recompile the OCIO nodes against your versions of the libraries. Failure to follow these steps may result in errors when adding OCIO nodes or modifying OCIO options in the preferences.