Skip to content

Commit

Permalink
first support for AdobeRGB colorspace
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Apr 19, 2008
1 parent fa1a2b4 commit 1a73876
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 2 deletions.
Binary file added src/ClayRGB1998.icc
Binary file not shown.
56 changes: 56 additions & 0 deletions src/ClayRGB1998_icc.h
Original file line number Diff line number Diff line change
@@ -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;
9 changes: 9 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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 \
Expand Down
9 changes: 9 additions & 0 deletions src/color-man.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
*-------------------------------------------------------------------
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions src/color-man.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef enum {
COLOR_PROFILE_NONE = 0,
COLOR_PROFILE_FILE,
COLOR_PROFILE_SRGB,
COLOR_PROFILE_ADOBERGB,
COLOR_PROFILE_MEM
} ColorManProfileType;

Expand Down
16 changes: 14 additions & 2 deletions src/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 1a73876

Please sign in to comment.