Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/openexr.imageio/exroutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <numeric>

#include <OpenImageIO/Imath.h>
#include <OpenImageIO/color.h>
#include <OpenImageIO/platform.h>

#include <OpenEXR/IlmThreadPool.h>
Expand Down Expand Up @@ -1026,6 +1027,15 @@ OpenEXROutput::spec_to_header(ImageSpec& spec, int subimage,
}
}

// Set color interop ID from colorspace
if (spec.get_string_attribute("colorInteropID").empty()) {
const ColorConfig& colorconfig(ColorConfig::default_colorconfig());
string_view colorspace = spec.get_string_attribute("oiio:ColorSpace");
string_view interop_id = colorconfig.get_color_interop_id(colorspace);
if (!interop_id.empty())
spec.attribute("colorInteropID", interop_id);
}

// Deal with all other params
for (const auto& p : spec.extra_attribs)
put_parameter(p.name().string(), p.type(), p.data(), header);
Expand Down
34 changes: 34 additions & 0 deletions testsuite/openexr-suite/ref/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,37 @@ Full command line was:
oiiotool ERROR: -o : Cannot output non-compliant ACES Container in 'strict' mode. REASON: EXR data type is not 'HALF' as required for an ACES Container.
Full command line was:
> oiiotool --create 4x4 3 -d float --compression none -sattrib openexr:ACESContainerPolicy strict -o strict-fail.exr
Reading color_interop_id_scene_linear.exr
color_interop_id_scene_linear.exr : 4 x 4, 3 channel, float openexr
SHA-1: D7699308C38CD04EEB732577A82D31D04E05A339
channel list: R, G, B
colorInteropID: "lin_ap1_scene"
compression: "zip"
PixelAspectRatio: 1
screenWindowCenter: 0, 0
screenWindowWidth: 1
oiio:ColorSpace: "lin_ap1_scene"
oiio:subimages: 1
openexr:lineOrder: "increasingY"
Reading color_interop_id_linear_adobergb.exr
color_interop_id_linear_adobergb.exr : 4 x 4, 3 channel, float openexr
SHA-1: D7699308C38CD04EEB732577A82D31D04E05A339
channel list: R, G, B
colorInteropID: "lin_adobergb_scene"
compression: "zip"
PixelAspectRatio: 1
screenWindowCenter: 0, 0
screenWindowWidth: 1
oiio:ColorSpace: "lin_adobergb_scene"
oiio:subimages: 1
openexr:lineOrder: "increasingY"
Reading color_interop_id_unknown.exr
color_interop_id_unknown.exr : 4 x 4, 3 channel, float openexr
SHA-1: D7699308C38CD04EEB732577A82D31D04E05A339
channel list: R, G, B
compression: "zip"
PixelAspectRatio: 1
screenWindowCenter: 0, 0
screenWindowWidth: 1
oiio:subimages: 1
openexr:lineOrder: "increasingY"
8 changes: 8 additions & 0 deletions testsuite/openexr-suite/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,11 @@

# Invalid data type
command += oiiotool("--create 4x4 3 -d float --compression none -sattrib openexr:ACESContainerPolicy strict -o strict-fail.exr", failureok=True)

# Check color interop ID output
command += oiiotool("--create 4x4 3 --attrib oiio:ColorSpace scene_linear -o color_interop_id_scene_linear.exr")
command += info_command("color_interop_id_scene_linear.exr", safematch=True)
command += oiiotool("--create 4x4 3 --attrib oiio:ColorSpace lin_adobergb_scene -o color_interop_id_linear_adobergb.exr")
command += info_command("color_interop_id_linear_adobergb.exr", safematch=True)
command += oiiotool("--create 4x4 3 --attrib oiio:ColorSpace unknown_interop_id -o color_interop_id_unknown.exr")
command += info_command("color_interop_id_unknown.exr", safematch=True)
Loading