diff --git a/src/dpx.imageio/dpxinput.cpp b/src/dpx.imageio/dpxinput.cpp index 5dfadd919f..6675e95ffe 100644 --- a/src/dpx.imageio/dpxinput.cpp +++ b/src/dpx.imageio/dpxinput.cpp @@ -312,9 +312,9 @@ DPXInput::seek_subimage(int subimage, int miplevel) // image linearity switch (m_dpx.header.Transfer(subimage)) { - case dpx::kLinear: m_spec.set_colorspace("Linear"); break; + case dpx::kLinear: m_spec.set_colorspace("lin_rec709_scene"); break; case dpx::kLogarithmic: m_spec.set_colorspace("KodakLog"); break; - case dpx::kITUR709: m_spec.set_colorspace("Rec709"); break; + case dpx::kITUR709: m_spec.set_colorspace("srgb_rec709_scene"); break; case dpx::kUserDefined: if (!std::isnan(m_dpx.header.Gamma()) && m_dpx.header.Gamma() != 0) { set_colorspace_rec709_gamma(m_spec, float(m_dpx.header.Gamma())); diff --git a/src/dpx.imageio/dpxoutput.cpp b/src/dpx.imageio/dpxoutput.cpp index 5667c83249..4db1103a3c 100644 --- a/src/dpx.imageio/dpxoutput.cpp +++ b/src/dpx.imageio/dpxoutput.cpp @@ -12,6 +12,7 @@ #include "libdpx/DPX.h" #include "libdpx/DPXColorConverter.h" +#include #include #include #include @@ -435,14 +436,18 @@ DPXOutput::prep_subimage(int s, bool allocate) m_desc = get_image_descriptor(); // transfer function + const ColorConfig& colorconfig = ColorConfig::default_colorconfig(); std::string colorspace = spec_s.get_string_attribute("oiio:ColorSpace", ""); - if (Strutil::iequals(colorspace, "Linear")) + if (colorconfig.equivalent(colorspace, "lin_rec709_scene")) m_transfer = dpx::kLinear; - else if (Strutil::istarts_with(colorspace, "Gamma")) - m_transfer = dpx::kUserDefined; - else if (Strutil::iequals(colorspace, "Rec709")) + else if (colorconfig.equivalent(colorspace, "srgb_rec709_scene")) m_transfer = dpx::kITUR709; - else if (Strutil::iequals(colorspace, "KodakLog")) + else if (colorconfig.equivalent(colorspace, "g22_rec709_scene") + || colorconfig.equivalent(colorspace, "g24_rec709_scene") + || colorconfig.equivalent(colorspace, "g18_rec709_scene") + || Strutil::istarts_with(colorspace, "Gamma")) + m_transfer = dpx::kUserDefined; + else if (colorconfig.equivalent(colorspace, "KodakLog")) m_transfer = dpx::kLogarithmic; else { std::string dpxtransfer = spec_s.get_string_attribute("dpx:Transfer", diff --git a/testsuite/python-imagebufalgo/src/test_imagebufalgo.py b/testsuite/python-imagebufalgo/src/test_imagebufalgo.py index 17e943e7af..9dbb0648c1 100755 --- a/testsuite/python-imagebufalgo/src/test_imagebufalgo.py +++ b/testsuite/python-imagebufalgo/src/test_imagebufalgo.py @@ -374,9 +374,9 @@ def test_iba (func: Callable[..., oiio.ImageBuf], *args, **kwargs) -> oiio.Image b.setpixel(0, 1, (.5,.5,.5,1)) b.setpixel(1, 1, (1,1,1,1)) dumpimg (b, msg="linear src=") - r = test_iba (ImageBufAlgo.colorconvert, b, "Linear", "sRGB") + r = test_iba (ImageBufAlgo.colorconvert, b, "lin_rec709", "sRGB") dumpimg (r, msg="to srgb =") - r = ImageBufAlgo.colorconvert(r, "sRGB", "Linear") + r = ImageBufAlgo.colorconvert(r, "sRGB", "lin_rec709") dumpimg (r, msg="back to linear =") # Just to test, make a matrix that halves red, doubles green, # adds 0.1 to blue.