[Bf-blender-cvs] [e9d3e056d1a] master: Fix T66571: Unable to change input color space of PSD

Sergey Sharybin noreply at git.blender.org
Wed Jul 10 10:10:45 CEST 2019


Commit: e9d3e056d1a61a552fa616d1bd5b41570ae7d765
Author: Sergey Sharybin
Date:   Wed Jul 10 10:08:18 2019 +0200
Branches: master
https://developer.blender.org/rBe9d3e056d1a61a552fa616d1bd5b41570ae7d765

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.

===================================================================

M	source/blender/imbuf/intern/oiio/openimageio_api.cpp

===================================================================

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;



More information about the Bf-blender-cvs mailing list