[Bf-blender-cvs] [35f5d80f3a3] blender-v2.79-release: Fix T52334: images with non-color data should not change color space on save.

Brecht Van Lommel noreply at git.blender.org
Thu Aug 17 14:45:10 CEST 2017


Commit: 35f5d80f3a351cf5c03e27159efed780b265f325
Author: Brecht Van Lommel
Date:   Thu Aug 10 14:11:18 2017 +0200
Branches: blender-v2.79-release
https://developer.blender.org/rB35f5d80f3a351cf5c03e27159efed780b265f325

Fix T52334: images with non-color data should not change color space on save.

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

M	source/blender/imbuf/intern/colormanagement.c
M	source/blender/imbuf/intern/jp2.c
M	source/blender/imbuf/intern/png.c
M	source/blender/imbuf/intern/tiff.c

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

diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 03f71b5878c..1f3be8d73bb 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2565,6 +2565,14 @@ const char *IMB_colormanagement_colorspace_get_indexed_name(int index)
 
 void IMB_colormanagment_colorspace_from_ibuf_ftype(ColorManagedColorspaceSettings *colorspace_settings, ImBuf *ibuf)
 {
+	/* Don't modify non-color data space, it does not change with file type. */
+	ColorSpace *colorspace = colormanage_colorspace_get_named(colorspace_settings->name);
+
+	if (colorspace && colorspace->is_data) {
+		return;
+	}
+
+	/* Get color space from file type. */
 	const ImFileType *type;
 
 	for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index 390f2502ee7..388c2734fe9 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -588,7 +588,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 	img_fol_t img_fol; /* only needed for cinema presets */
 	memset(&img_fol, 0, sizeof(img_fol_t));
 	
-	if (ibuf->float_colorspace) {
+	if (ibuf->float_colorspace || (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA)) {
 		/* float buffer was managed already, no need in color space conversion */
 		chanel_colormanage_cb = channel_colormanage_noop;
 	}
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 503e63a3fb1..dded0f7aecf 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -152,7 +152,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
 	compression = (int)(((float)(ibuf->foptions.quality) / 11.1111f));
 	compression = compression < 0 ? 0 : (compression > 9 ? 9 : compression);
 
-	if (ibuf->float_colorspace) {
+	if (ibuf->float_colorspace || (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA)) {
 		/* float buffer was managed already, no need in color space conversion */
 		chanel_colormanage_cb = channel_colormanage_noop;
 	}
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 4368a428186..8e5cf80e013 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -822,7 +822,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 				/* convert from float source */
 				float rgb[4];
 				
-				if (ibuf->float_colorspace) {
+				if (ibuf->float_colorspace || (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA)) {
 					/* float buffer was managed already, no need in color space conversion */
 					copy_v3_v3(rgb, &fromf[from_i]);
 				}




More information about the Bf-blender-cvs mailing list