From e9d3e056d1a61a552fa616d1bd5b41570ae7d765 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 10 Jul 2019 10:08:18 +0200 Subject: 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. --- .../blender/imbuf/intern/oiio/openimageio_api.cpp | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'source/blender') 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; -- cgit v1.2.3