# Colour and OCIO

> Scene-linear working space, file colour spaces on Read and Write, and the Viewer's display transform.

Oink manages colour with OpenColorIO (OCIO).

## The config

- If the `OCIO` environment variable points at a config, that config is used (Nuke honours `$OCIO` the same way).
- Otherwise Oink uses the OCIO config that ships in the repository (`resources/`, the same config Blender 5.2 uses), which includes sRGB, Rec.709, ACES 1.3 / 2.0, AgX and Filmic.

## Working space

Everything between Read and Write is **scene-linear** (the config's `scene_linear` role), 32-bit float, and never clamped. Values above 1 and below 0 survive every node unless a node clamps on purpose.

## Read and Write

- A [Read](/docs/nodes/read)'s **input transform** converts the file to the working space. `default` picks by file type, using the config's default roles:

  | File | default colour space |
  |---|---|
  | float files (EXR, HDR, float TIFF) | scene linear |
  | log files (DPX, Cineon) | the config's compositing log |
  | 8- and 16-bit integer files (PNG, JPEG, TIFF …) | sRGB |

  **raw data** skips the conversion (for data such as depth or motion vectors).
- A [Write](/docs/nodes/write)'s **output transform** converts back when writing.
- Inside the comp, [OCIOColorSpace](/docs/nodes/ociocolorspace), [Colorspace](/docs/nodes/colorspace), [OCIODisplay](/docs/nodes/ociodisplay) and [CDL](/docs/nodes/cdl) convert explicitly. OCIODisplay also has *gain*, *gamma* and *saturation* knobs; dragging them is fast because they are applied as live values, not as a rebuilt transform.
- Movie files (MOV, MP4 and the like) use the colour tags stored in the file (transfer and primaries) to pick the input colour space. A movie with no tags is read as Rec.709 with gamma 2.4. Web images (GIF, WebP) count as sRGB.

## The Viewer

The Viewer shows the image through a display transform picked in its header: an OCIO **display** (default sRGB) and **view** (default the config's default view). The Viewer's gain (exposure in f-stops) and gamma apply only to what you see, never to the comp or to rendered files. Channel buttons, clipping warnings and the pixel readout work on the float values.


---
Sources: opencomp_core/nodes/io/colorspace.py, opencomp_core/nodes/color/colorspace_nodes.py, opencomp_server/display.py, opencomp_electron/src/components/Viewer.tsx, opencomp_electron/src/components/properties/knobSchema.ts
