Skip to content

Refine colorInteropID support - #2560

Open
doug-walker wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
doug-walker:walker/interopid
Open

Refine colorInteropID support#2560
doug-walker wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
doug-walker:walker/interopid

Conversation

@doug-walker

@doug-walker doug-walker commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Now that the ASWF Color Interop Forum has published the Recommendations for the Color Interop ID and for identifying the color space of OpenEXR files, I've made an attempt to build on Cary's earlier PR and integrate the standard colorInteropID attribute more fully into the library.

  • Updated StandardAttributes and TechnicalIntroduction website pages.
  • Add support for colorInteropID to command-line tools exrstdattr and exr2aces.
  • Replaced links to the earlier draft recommendations on Google Docs with the Color Interop Forum URLs.
  • Attempted to update multi-part handling for colorInteropID, along the lines of how chromaticities is handled. This is the part of this PR that needs the most careful review, since I'm not an expert in exactly how this part of the API is used, in practice.
  • Added unit tests for all of the above. All tests pass locally on my machine.
  • Added a couple of TODOs to potentially support colorInteropID as an alternative to chromatcitities, for example when decoding luma/chroma images, or when converting the color space to ACES2065-1 in exr2aces. I'd be interested in feedback about how useful people feel such functionality would be.
  • Noticed that exr2aces and its underlying modules such as ImfAcesFile are making incorrect statements about what SMPTE ST 2065-4 actually says. Addressing this would be out of scope for this PR, but added a couple of TODOs to at least alert people reading the code to the issue.

This PR was assisted by Claude Code Sonnet 5.

Signed-off-by: Doug Walker <doug.walker@autodesk.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 29, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: doug-walker / name: Doug Walker (03d72ad)

@doug-walker doug-walker left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some comments that might be helpful to reviewers of this PR.

// New in OpenEXR v3.4

IMF_STD_ATTRIBUTE_DEF (colorInteropID, ColorInteropID, std::string)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the links and moved this up to be next to chromaticities.

Comment thread website/bin/exr2aces.rst

If the `chromaticities` attribute of inFile contains chromaticities that
do not match ST 2065-1, a 3x3 matrix will be computed and applied to convert
the color space while generating outFile.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the existing comment about chromaticities very confusing and misleading, so decided to rewrite it, even though I did not change anything about how exr2aces works in this regard.

For RGB images, specifies the CIE (x,y) chromaticities of the
primaries and the white point.
primaries and the white point. Note: For most purposes, this
attribute has now been superseded by the colorInteropID.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was trying to figure out the right language here to capture the fact that the CIF OpenEXR document recommends that people switch over to using colorInteropID rather than chromaticities for most purposes.


</td>
</tr>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the links and moved this up to be next to chromaticities.

Application developers are asked to take care when writing OpenEXR
files to avoid writing or propagating color space metadata which may
be incorrect. The colorInteropID should be omitted or set to ``unknown``
unless the application is confident in the value being written.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote this based on colorInteropID rather than chromaticities.

In particular, you will notice that I removed the sentence: "If a file doesn't have a chromaticities attribute, display software should assume that the file's primaries and the white point match Rec. ITU-R BT.709-3." This was intentional for several reasons:

  1. It contradicts the new Color Interop Forum OpenEXR recommendation.
  2. It should probably be up to the application and/or color management system to determine the default, rather than making a blanket statement in OpenEXR.
  3. I feel this is partially responsible for application developers sometimes setting the chromaticities to Rec.709 even if they have no idea what the color space actually is, thereby breaking trust in the chromaticities attribute.

And I removed the part about CIE XYZ since it was misleading. If anyone did want to write XYZ values into an EXR file, it would typically not be using illuminant E (1/3, 1/3) as the white point.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be worth retaining some description of the chromaticities attribute, even if it is described as deprecated/legacy/ACES-only, since such files will continue to exist and need to be understood.
I'm also not clear if there's still a use case for using it to store completely arbitrary chromaticities, which the recommendation allows as long as no colorInteropID is set.
The Rec,709 and XYZ bits can go, though!

Color Interop ID. Provides a mechanism to identify the color space of the RGB images.
See `An ID for Color Interop <https://github.com/AcademySoftwareFoundation/ColorInterop/blob/main/Recommendations/03_ColorInteropID/ColorInteropID.md>`_
and `Identifying the Color Space of OpenEXR Files <https://github.com/AcademySoftwareFoundation/ColorInterop/blob/main/Recommendations/04_OpenEXRFiles/OpenEXRFiles.md>`_ for details.
New in OpenEXR v3.4.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the links and moved it up to be next to chromaticities.

// Color Interop Forum recommendation for OpenEXR files.
//

const std::string& acesColorInteropID ();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a file has acesContainerFlag and Chromaticities set to ACES, but the colorInteropID set to something else? Should the input side error, or change the colorInteropID on reading? Arguably, SMPTE 2065-4 would say that correct behavior is to ignore the colorInteropID, so it "doesn't exist" in ACES files

// ColorInteropID -- leave a part's existing "data" tag alone, since
// it marks image data that is intentionally not color managed.
//
if (!hasColorInteropID (dst) || colorInteropID (dst) != "data")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this enforce that if the first part is data, then all parts must be data, but not the other way round? Is that intentional? (or should the clause also be skipped if src has a colorInteropID set to data, and the checkSharedAttributesvalues function have a similar clause?)

In any case, if parts are written with different colorinteropIDs, this function will delete that information from other parts, causing the reader to treat them as being in the wrong space. I would prefer either that the library always checked for colorInteropID consistency on MultiPartOutputFile with no option to bypass test or automatically "fix" attribute, or else all the colorInteropID logic was dropped from the SharedAttribute code, making the multipart rules of the Recommendation less strict.

@peterhillman

Copy link
Copy Markdown
Collaborator

What are your thoughts about adding support for colorInteropID names to the Chromaticities? Perhaps the spaces listed in the recommendation (lin_rec709_scene, lin_ap0_scene, lin_ap1_scene, lin_p3d65_scene, lin_rec2020_scene, lin_adobergb_scene) could be added as static Chromaticities variables, and a function added to turn those strings into chromaticities?

For lightweight utilities that aren't intended to be part of a VFX pipeline so don't need OpenColorIO, some kind of built-in support to help convert images to and from known space could encourage adoption of the attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants