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.
This commit is contained in:
parent
0829bd7b66
commit
e9d3e056d1
Notes:
blender-bot
2023-02-14 10:21:10 +01:00
Referenced by issue #66571, Image Texture: if open PSD file, color space option always switched back to sRGB
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue