Skip to content

Commit 934de72

Browse files
committed
Address comments, update docs to discourage using "sRGB" colorspace
Signed-off-by: Brecht Van Lommel <[email protected]>
1 parent df9357b commit 934de72

File tree

7 files changed

+28
-22
lines changed

7 files changed

+28
-22
lines changed

src/doc/builtinplugins.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ tiles.
6060
- Version of the BMP file format
6161
* - ``oiio:ColorSpace``
6262
- string
63-
- currently, it is always ``"sRGB"`` (we presume all BMP files are sRGB)
63+
- currently, it is always ``"srgb_rec709_display"`` or
64+
``"srgb_rec709_scene"`` (we presume all BMP files are sRGB)
6465

6566
**Configuration settings for BMP input**
6667

src/doc/imagebufalgo.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,12 +2849,14 @@ Color space conversion
28492849
.. code-tab:: c++
28502850

28512851
ImageBuf Src ("tahoe.jpg");
2852-
ImageBuf Dst = ImageBufAlgo::colorconvert (Src, "sRGB", "acescg", true);
2852+
ImageBuf Dst = ImageBufAlgo::colorconvert (Src, "srgb_rec709_scene",
2853+
"acescg", true);
28532854

28542855
.. code-tab:: py
28552856

28562857
Src = ImageBuf("tahoe.jpg")
2857-
Dst = ImageBufAlgo.colorconvert (Src, "sRGB", "acescg", True)
2858+
Dst = ImageBufAlgo.colorconvert (Src, "srgb_rec709_scene", "acescg",
2859+
True)
28582860

28592861
.. code-tab:: bash oiiotool
28602862

@@ -2950,14 +2952,15 @@ Color space conversion
29502952
.. code-tab:: c++
29512953

29522954
ImageBuf Src ("tahoe.exr");
2953-
ImageBuf Dst = ImageBufAlgo::ociodisplay (Src, "sRGB", "Film", "lnf",
2954-
"", true, "SHOT", "pe0012");
2955+
ImageBuf Dst = ImageBufAlgo::ociodisplay (Src, "srgb_rec709_scene",
2956+
"Film", "lnf", "", true,
2957+
"SHOT", "pe0012");
29552958

29562959
.. code-tab:: py
29572960

29582961
Src = ImageBuf("tahoe.jpg")
2959-
Dst = ImageBufAlgo.ociodisplay (Src, "sRGB", "Film", "lnf",
2960-
"", True, "SHOT", "pe0012")
2962+
Dst = ImageBufAlgo.ociodisplay (Src, "srgb_rec709_scene", "Film",
2963+
"lnf", "", True, "SHOT", "pe0012")
29612964

29622965
.. code-tab:: bash oiiotool
29632966

src/doc/pythonbindings.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3610,7 +3610,8 @@ Color manipulation
36103610
.. code-block:: python
36113611
36123612
Src = ImageBuf ("tahoe.jpg")
3613-
Dst = ImageBufAlgo.colorconvert (Src, "sRGB", "scene_linear")
3613+
Dst = ImageBufAlgo.colorconvert (Src, "srgb_rec709_scene",
3614+
"scene_linear")
36143615
36153616
36163617
@@ -3660,7 +3661,7 @@ Color manipulation
36603661
.. code-block:: python
36613662
36623663
Src = ImageBuf ("tahoe.exr")
3663-
Dst = ImageBufAlgo.ociodisplay (Src, "sRGB", "Film", "lnf",
3664+
Dst = ImageBufAlgo.ociodisplay (Src, "srgb_rec709_scene", "Film", "lnf",
36643665
context_key="SHOT", context_value="pe0012")
36653666
36663667

src/doc/stdmetadata.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ Color information
150150
- `"lin_ap0_scene"` : ACES2065-1, the recommended ACES space for
151151
interchange and archiving.
152152
- `"srgb_rec709_display"` : Using standard (piecewise) sRGB response and
153-
primaries. The token `"sRGB"` is treated as a synonym.
153+
primaries. The token `"sRGB"` is treated as a synonym, but it is
154+
recommended to use the more specific interop ID.
154155
- `"srgb_rec709_scene"` : Same response and primaries as
155156
`"srgb_rec709_display"` but for scene referred images.
156157
- `"g22_rec709_display"` : Rec709/sRGB primaries, but using a response curve

src/include/OpenImageIO/imageio.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,10 @@ class OIIO_API ImageSpec {
912912
/// 1. Assigning to the delegate adds a metadata attribute:
913913
///
914914
/// ImageSpec spec;
915-
/// spec["foo"] = 42; // int
916-
/// spec["pi"] = float(M_PI); // float
917-
/// spec["oiio:ColorSpace"] = "sRGB"; // string
918-
/// spec["cameratoworld"] = Imath::Matrix44(...); // matrix
915+
/// spec["foo"] = 42; // int
916+
/// spec["pi"] = float(M_PI); // float
917+
/// spec["oiio:ColorSpace"] = "srgb_rec709_display"; // string
918+
/// spec["cameratoworld"] = Imath::Matrix44(...); // matrix
919919
///
920920
/// Be very careful, the attribute's type will be implied by the C++
921921
/// type of what you assign.

src/libOpenImageIO/color_ocio.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,7 +2100,8 @@ struct ColorInteropID {
21002100
// Mapping between color interop ID and CICP, based on Color Interop Forum
21012101
// recommendations.
21022102
constexpr ColorInteropID color_interop_ids[] = {
2103-
// Display referred interop IDs.
2103+
// Display referred interop IDs first so they are the default in automatic.
2104+
// conversion from CICP to interop ID.
21042105
{ "srgb_rec709_display", CICPPrimaries::Rec709, CICPTransfer::sRGB,
21052106
CICPMatrix::BT709 },
21062107
// Not all software interprets this CICP the same, see the
@@ -2137,9 +2138,9 @@ constexpr ColorInteropID color_interop_ids[] = {
21372138
{ "ocio:lin_ciexyzd65_display", CICPPrimaries::XYZD65, CICPTransfer::Linear,
21382139
CICPMatrix::Unspecified },
21392140

2140-
// Scene referred interop IDs first so they are the default in automatic
2141-
// conversion from CICP to interop ID. Some are not display color spaces
2142-
// at all, but can be represented by CICP anyway.
2141+
// Scene referred interop IDs. These have CICPs even if it can be argued
2142+
// those are only meant for display color spaces. It still improves interop
2143+
// with other software that does not care about the distinction.
21432144
{ "lin_ap1_scene" },
21442145
{ "lin_ap0_scene" },
21452146
{ "lin_rec709_scene", CICPPrimaries::Rec709, CICPTransfer::Linear,
@@ -2199,7 +2200,7 @@ string_view
21992200
ColorConfig::get_color_interop_id(const int cicp[4],
22002201
const string_view prefer_image_state) const
22012202
{
2202-
string_view other_interop_id;
2203+
string_view other_interop_id = "";
22032204
for (const ColorInteropID& interop : color_interop_ids) {
22042205
if (interop.has_cicp && interop.cicp[0] == cicp[0]
22052206
&& interop.cicp[1] == cicp[1]) {

src/raw.imageio/rawinput.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,7 @@ RawInput::open_raw(bool unpack, bool process, const std::string& name,
578578
m_processor->imgdata.params.gamm[0] = 1.0;
579579
m_processor->imgdata.params.gamm[1] = 1.0;
580580
} else if (cs.empty() || colorconfig.equivalent(cs, "srgb_rec709_display")
581-
|| colorconfig.equivalent(cs, "srgb_rec709_scene")
582-
|| Strutil::iequals(cs, "sRGB") /* Necessary? */) {
581+
|| colorconfig.equivalent(cs, "srgb_rec709_scene")) {
583582
// Request explicit sRGB, including usual sRGB response
584583
m_processor->imgdata.params.output_color = 1;
585584
m_processor->imgdata.params.gamm[0] = 1.0 / 2.4;
@@ -589,7 +588,7 @@ RawInput::open_raw(bool unpack, bool process, const std::string& name,
589588
|| Strutil::iequals(cs, "lin_srgb")
590589
|| Strutil::iequals(cs, "lin_rec709")
591590
|| Strutil::iequals(cs, "linear") /* DEPRECATED */) {
592-
// Request "sRGB" primaries, linear response
591+
// Request sRGB primaries, linear response
593592
m_processor->imgdata.params.output_color = 1;
594593
m_processor->imgdata.params.gamm[0] = 1.0;
595594
m_processor->imgdata.params.gamm[1] = 1.0;

0 commit comments

Comments
 (0)