diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-10 11:08:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-07-10 11:08:18 +0300 |
commit | e9d3e056d1a61a552fa616d1bd5b41570ae7d765 (patch) | |
tree | 4fa4b0eb977afca8e02e3b5759a7004165019e28 /source/blender | |
parent | 0829bd7b66a709ea924cacf90cc1469e6907af5a (diff) |
Fix T66571: Unable to change input color space of PSD
Image reader must not override file's color space specification if it
is already specified.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/imbuf/intern/oiio/openimageio_api.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index 7a47d0f7787..d2147f833c3 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -197,6 +197,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac bool is_float, is_alpha; int basesize; char file_colorspace[IM_MAX_SPACE]; + const bool is_colorspace_manually_set = (colorspace[0] != '\0'); /* load image from file through OIIO */ if (imb_is_a_photoshop(filename) == 0) { @@ -221,17 +222,19 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac return NULL; } - string ics = spec.get_string_attribute("oiio:ColorSpace"); - BLI_strncpy(file_colorspace, ics.c_str(), IM_MAX_SPACE); + if (!is_colorspace_manually_set) { + string ics = spec.get_string_attribute("oiio:ColorSpace"); + BLI_strncpy(file_colorspace, ics.c_str(), IM_MAX_SPACE); - /* only use colorspaces exis */ - if (colormanage_colorspace_get_named(file_colorspace)) { - strcpy(colorspace, file_colorspace); - } - else { - std::cerr << __func__ << ": The embed colorspace (\"" << file_colorspace - << "\") not supported in existent OCIO configuration file. Fallback " - << "to system default colorspace (\"" << colorspace << "\")." << std::endl; + /* only use colorspaces exis */ + if (colormanage_colorspace_get_named(file_colorspace)) { + strcpy(colorspace, file_colorspace); + } + else { + std::cerr << __func__ << ": The embed colorspace (\"" << file_colorspace + << "\") not supported in existent OCIO configuration file. Fallback " + << "to system default colorspace (\"" << colorspace << "\")." << std::endl; + } } width = spec.width; |