| 93 | } |
| 94 | |
| 95 | void SetImageSpecColorSpace(OIIO::ImageSpec& image_spec, |
| 96 | const OIIO::string_view& colorspace) { |
| 97 | EnsureOpenImageIOInitialized(); |
| 98 | #if OIIO_VERSION >= OIIO_MAKE_VERSION(3, 0, 0) |
| 99 | image_spec.set_colorspace(colorspace); |
| 100 | #else |
| 101 | // Extract logic from 3.0.0 version for backwards compatibility. |
| 102 | const OIIO::string_view oldspace = |
| 103 | image_spec.get_string_attribute("oiio:ColorSpace"); |
| 104 | if (oldspace.size() && colorspace.size() && oldspace == colorspace) { |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | if (colorspace.empty()) { |
| 109 | image_spec.erase_attribute("oiio:ColorSpace"); |
| 110 | } else { |
| 111 | image_spec.attribute("oiio:ColorSpace", colorspace); |
| 112 | } |
| 113 | |
| 114 | if (colorspace != "sRGB") { |
| 115 | image_spec.erase_attribute("Exif:ColorSpace"); |
| 116 | } |
| 117 | |
| 118 | image_spec.erase_attribute("tiff:ColorSpace"); |
| 119 | image_spec.erase_attribute("tiff:PhotometricInterpretation"); |
| 120 | image_spec.erase_attribute("oiio:Gamma"); |
| 121 | #endif |
| 122 | } |
| 123 | |
| 124 | bool IsEquivalentColorSpace(const std::string_view& colorspace1, |
| 125 | const std::string_view& colorspace2) { |
no test coverage detected