first support for AdobeRGB colorspace
authorVladimir Nadvornik <nadvornik@suse.cz>
Sat, 19 Apr 2008 16:26:29 +0000 (16:26 +0000)
committerVladimir Nadvornik <nadvornik@suse.cz>
Sat, 19 Apr 2008 16:26:29 +0000 (16:26 +0000)
src/ClayRGB1998.icc [new file with mode: 0644]
src/ClayRGB1998_icc.h [new file with mode: 0644]
src/Makefile.am
src/color-man.c
src/color-man.h
src/image.c

diff --git a/src/ClayRGB1998.icc b/src/ClayRGB1998.icc
new file mode 100644 (file)
index 0000000..1eedf09
Binary files /dev/null and b/src/ClayRGB1998.icc differ
diff --git a/src/ClayRGB1998_icc.h b/src/ClayRGB1998_icc.h
new file mode 100644 (file)
index 0000000..fb0e6c8
--- /dev/null
@@ -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;
index 9420c90..2cdb574 100644 (file)
@@ -43,6 +43,13 @@ ui_icons.h: $(extra_ICONS) Makefile.in
         $(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 @@ bin_PROGRAMS = geeqie
 
 geeqie_SOURCES = \
        $(module_SLIK)  \
+       ClayRGB1998.icc \
+       ClayRGB1998_icc.h \
        bar_info.c      \
        bar_info.h      \
        bar_exif.c      \
index 3e32233..d52296f 100644 (file)
@@ -58,6 +58,12 @@ static void color_man_lib_init(void)
        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 @@ static cmsHPROFILE color_man_cache_load_profile(ColorManProfileType type, const
                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)
                                {
index 4dc4f04..088f562 100644 (file)
@@ -17,6 +17,7 @@ typedef enum {
        COLOR_PROFILE_NONE = 0,
        COLOR_PROFILE_FILE,
        COLOR_PROFILE_SRGB,
+       COLOR_PROFILE_ADOBERGB,
        COLOR_PROFILE_MEM
 } ColorManProfileType;
 
index f029a21..5d0686c 100644 (file)
@@ -382,16 +382,28 @@ static gint image_post_process_color(ImageWindow *imd, gint start_row, ExifData
                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);
                        }
                }