Mercurial > geeqie.yaz
changeset 1357:4ca837d74999
image_post_process_color(): remove exif parameter, just extract it when needed.
author | zas_ |
---|---|
date | Sun, 01 Mar 2009 15:54:37 +0000 |
parents | 681e79dd0820 |
children | db324ac52bcc |
files | src/image.c |
diffstat | 1 files changed, 37 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/src/image.c Sun Mar 01 15:41:51 2009 +0000 +++ b/src/image.c Sun Mar 01 15:54:37 2009 +0000 @@ -189,7 +189,7 @@ *------------------------------------------------------------------- */ -static gint image_post_process_color(ImageWindow *imd, gint start_row, ExifData *exif, gint run_in_bg) +static gint image_post_process_color(ImageWindow *imd, gint start_row, gint run_in_bg) { ColorMan *cm; ColorManProfileType input_type; @@ -239,44 +239,53 @@ } imd->color_profile_from_image = COLOR_PROFILE_NONE; - if (imd->color_profile_use_image && exif) + if (imd->color_profile_use_image) { - profile = exif_get_color_profile(exif, &profile_len); - if (!profile) + ExifData *exif = exif_read_fd(imd->image_fd); + + if (exif) { - gint cs; - gchar *interop_index; - - /* ColorSpace == 1 specifies sRGB per EXIF 2.2 */ - 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) + profile = exif_get_color_profile(exif, &profile_len); + if (!profile) { - input_type = COLOR_PROFILE_SRGB; - input_file = NULL; - imd->color_profile_from_image = COLOR_PROFILE_SRGB; + gint cs; + gchar *interop_index; + + /* ColorSpace == 1 specifies sRGB per EXIF 2.2 */ + 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; + imd->color_profile_from_image = COLOR_PROFILE_SRGB; - DEBUG_1("Found EXIF ColorSpace of sRGB"); + DEBUG_1("Found EXIF ColorSpace of sRGB"); + } + if (cs == 2 || (interop_index && !strcmp(interop_index, "R03"))) + { + input_type = COLOR_PROFILE_ADOBERGB; + input_file = NULL; + imd->color_profile_from_image = COLOR_PROFILE_ADOBERGB; + + DEBUG_1("Found EXIF ColorSpace of AdobeRGB"); + } + + g_free(interop_index); } - if (cs == 2 || (interop_index && !strcmp(interop_index, "R03"))) + else { - input_type = COLOR_PROFILE_ADOBERGB; - input_file = NULL; - imd->color_profile_from_image = COLOR_PROFILE_ADOBERGB; - - DEBUG_1("Found EXIF ColorSpace of AdobeRGB"); + DEBUG_1("Found embedded color profile"); + imd->color_profile_from_image = COLOR_PROFILE_MEM; } - - g_free(interop_index); + + exif_free_fd(imd->image_fd, exif); } } if (profile) { - DEBUG_1("Found embedded color profile"); - imd->color_profile_from_image = COLOR_PROFILE_MEM; - cm = color_man_new_embedded(run_in_bg ? imd : NULL, NULL, profile, profile_len, screen_type, screen_file); @@ -1039,17 +1048,7 @@ if (imd->color_profile_enable) { - ExifData *exif = NULL; - - if (imd->color_profile_use_image) exif = exif_read_fd(imd->image_fd); - - if (!image_post_process_color(imd, 0, exif, FALSE)) - { - /* fixme: note error to user */ -// image_state_set(imd, IMAGE_STATE_COLOR_ADJ); - } - if (exif) exif_free_fd(imd->image_fd, exif); - + image_post_process_color(imd, 0, FALSE); /* TODO: error handling */ } if (imd->cm || imd->desaturate)