changeset 424:26c6e768bd47

first support for AdobeRGB colorspace
author nadvornik
date Sat, 19 Apr 2008 16:26:29 +0000
parents 38cee6e724fa
children 10efd67e5d3c
files src/ClayRGB1998.icc src/ClayRGB1998_icc.h src/Makefile.am src/color-man.c src/color-man.h src/image.c
diffstat 6 files changed, 89 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
Binary file src/ClayRGB1998.icc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ClayRGB1998_icc.h	Sat Apr 19 16:26:29 2008 +0000
@@ -0,0 +1,56 @@
+/*
+ * This file was generated from ClayRGB1998.icc, DO NOT EDIT 
+ * http://www.argyllcms.com/ClayRGB1998.zip 
+ */ 
+unsigned char ClayRGB1998_icc[] = {
+  0x00, 0x00, 0x02, 0x44, 0x61, 0x72, 0x67, 0x6c, 0x02, 0x20, 0x00, 0x00,
+  0x6d, 0x6e, 0x74, 0x72, 0x52, 0x47, 0x42, 0x20, 0x58, 0x59, 0x5a, 0x20,
+  0x07, 0xd6, 0x00, 0x07, 0x00, 0x08, 0x00, 0x03, 0x00, 0x1c, 0x00, 0x2f,
+  0x61, 0x63, 0x73, 0x70, 0x4d, 0x53, 0x46, 0x54, 0x00, 0x00, 0x00, 0x00,
+  0x6e, 0x6f, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6,
+  0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d, 0x61, 0x72, 0x67, 0x6c,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
+  0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x7b,
+  0x63, 0x70, 0x72, 0x74, 0x00, 0x00, 0x01, 0x78, 0x00, 0x00, 0x00, 0x35,
+  0x77, 0x74, 0x70, 0x74, 0x00, 0x00, 0x01, 0xb0, 0x00, 0x00, 0x00, 0x14,
+  0x62, 0x6b, 0x70, 0x74, 0x00, 0x00, 0x01, 0xc4, 0x00, 0x00, 0x00, 0x14,
+  0x72, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x01, 0xd8, 0x00, 0x00, 0x00, 0x14,
+  0x67, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x01, 0xec, 0x00, 0x00, 0x00, 0x14,
+  0x62, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x14,
+  0x72, 0x54, 0x52, 0x43, 0x00, 0x00, 0x02, 0x14, 0x00, 0x00, 0x00, 0x0e,
+  0x67, 0x54, 0x52, 0x43, 0x00, 0x00, 0x02, 0x24, 0x00, 0x00, 0x00, 0x0e,
+  0x62, 0x54, 0x52, 0x43, 0x00, 0x00, 0x02, 0x34, 0x00, 0x00, 0x00, 0x0e,
+  0x64, 0x65, 0x73, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21,
+  0x43, 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6c, 0x65, 0x20, 0x77,
+  0x69, 0x74, 0x68, 0x20, 0x41, 0x64, 0x6f, 0x62, 0x65, 0x20, 0x52, 0x47,
+  0x42, 0x20, 0x28, 0x31, 0x39, 0x39, 0x38, 0x29, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00,
+  0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x20, 0x44, 0x6f, 0x6d, 0x61, 0x69,
+  0x6e, 0x2e, 0x20, 0x4e, 0x6f, 0x20, 0x57, 0x61, 0x72, 0x72, 0x61, 0x6e,
+  0x74, 0x79, 0x2c, 0x20, 0x55, 0x73, 0x65, 0x20, 0x61, 0x74, 0x20, 0x6f,
+  0x77, 0x6e, 0x20, 0x72, 0x69, 0x73, 0x6b, 0x2e, 0x00, 0x00, 0x00, 0x00,
+  0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0x51,
+  0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x16, 0xcc, 0x58, 0x59, 0x5a, 0x20,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x9c, 0x18, 0x00, 0x00, 0x4f, 0xa5, 0x00, 0x00, 0x04, 0xfc,
+  0x58, 0x59, 0x5a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x8d,
+  0x00, 0x00, 0xa0, 0x2c, 0x00, 0x00, 0x0f, 0x95, 0x58, 0x59, 0x5a, 0x20,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x31, 0x00, 0x00, 0x10, 0x2f,
+  0x00, 0x00, 0xbe, 0x9c, 0x63, 0x75, 0x72, 0x76, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x01, 0x02, 0x33, 0x00, 0x00, 0x63, 0x75, 0x72, 0x76,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x33, 0x00, 0x00,
+  0x63, 0x75, 0x72, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+  0x02, 0x33, 0x00, 0x00
+};
+unsigned int ClayRGB1998_icc_len = 580;
--- a/src/Makefile.am	Sat Apr 19 16:10:08 2008 +0000
+++ b/src/Makefile.am	Sat Apr 19 16:26:29 2008 +0000
@@ -43,6 +43,13 @@
 	 $(GDK_PIXBUF_CSOURCE) --raw --extern --build-list $(ICON_PAIRS); \
 	 echo '#endif /* UI_ICONS_H */') > $@ || echo "!!! Failed to generate $@ !!!"
 
+ClayRGB1998_icc.h: ClayRGB1998.icc
+	echo "/*" > $@ 
+	echo " * This file was generated from ClayRGB1998.icc, DO NOT EDIT " >> $@
+	echo " * http://www.argyllcms.com/ClayRGB1998.zip " >> $@
+	echo " */ " >> $@
+	xxd -i $^ >> $@
+
 ui_spinner.o: ui_icons.h
 
 
@@ -56,6 +63,8 @@
 
 geeqie_SOURCES = \
 	$(module_SLIK)	\
+	ClayRGB1998.icc \
+	ClayRGB1998_icc.h \
 	bar_info.c	\
 	bar_info.h	\
 	bar_exif.c	\
--- a/src/color-man.c	Sat Apr 19 16:10:08 2008 +0000
+++ b/src/color-man.c	Sat Apr 19 16:26:29 2008 +0000
@@ -58,6 +58,12 @@
 	cmsErrorAction(LCMS_ERROR_IGNORE);
 }
 
+static cmsHPROFILE color_man_create_adobe_comp()
+{
+	/* ClayRGB1998 is AdobeRGB compatible */
+#include "ClayRGB1998_icc.h"
+	return cmsOpenProfileFromMem(ClayRGB1998_icc, ClayRGB1998_icc_len);
+}
 
 /*
  *-------------------------------------------------------------------
@@ -113,6 +119,9 @@
 		case COLOR_PROFILE_SRGB:
 			profile = cmsCreate_sRGBProfile();
 			break;
+		case COLOR_PROFILE_ADOBERGB:
+			profile = color_man_create_adobe_comp();
+			break;
 		case COLOR_PROFILE_MEM:
 			if (data)
 				{
--- a/src/color-man.h	Sat Apr 19 16:10:08 2008 +0000
+++ b/src/color-man.h	Sat Apr 19 16:26:29 2008 +0000
@@ -17,6 +17,7 @@
 	COLOR_PROFILE_NONE = 0,
 	COLOR_PROFILE_FILE,
 	COLOR_PROFILE_SRGB,
+	COLOR_PROFILE_ADOBERGB,
 	COLOR_PROFILE_MEM
 } ColorManProfileType;
 
--- a/src/image.c	Sat Apr 19 16:10:08 2008 +0000
+++ b/src/image.c	Sat Apr 19 16:26:29 2008 +0000
@@ -382,16 +382,28 @@
 		if (!item)
 			{
 			gint cs;
+			gchar *interop_index;
 
 			/* ColorSpace == 1 specifies sRGB per EXIF 2.2 */
-			if (exif_get_integer(exif, "Exif.Photo.ColorSpace", &cs) &&
-			    cs == 1)
+			if (!exif_get_integer(exif, "Exif.Photo.ColorSpace", &cs)) cs = 0;
+			interop_index = exif_get_data_as_text(exif, "Exif.Iop.InteroperabilityIndex");			
+			
+			if (cs == 1)
 				{
 				input_type = COLOR_PROFILE_SRGB;
 				input_file = NULL;
 
 				if (debug) printf("Found EXIF ColorSpace of sRGB\n");
 				}
+			if (cs == 2 || (interop_index && !strcmp(interop_index, "R03")))
+				{
+				input_type = COLOR_PROFILE_ADOBERGB;
+				input_file = NULL;
+
+				if (debug) printf("Found EXIF ColorSpace of AdobeRGB\n");
+				}
+				
+			g_free(interop_index);
 			}
 		}