summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-07-08 16:55:43 -0400
committerraveit65 <[email protected]>2019-09-12 15:58:38 +0200
commit5210c1f71e66deb1e4d4be84f72f30d6061b292b (patch)
tree090df214bd8bbb2f22423833ca944dd63f933451
parent44e3ad862f524c9443c67095b2d702c083929cf4 (diff)
downloadeom-5210c1f71e66deb1e4d4be84f72f30d6061b292b.tar.bz2
eom-5210c1f71e66deb1e4d4be84f72f30d6061b292b.tar.xz
EomImage: Check GdkPixbuf for an ICC profile before falling back to sRGB
If an image's ICC profile cannot be extracted check whether GdkPixbuf was able to extract one before falling back to sRGB. This makes it possible to color correct TIFF images. https://bugzilla.gnome.org/show_bug.cgi?id=727467 upstream commit: https://gitlab.gnome.org/GNOME/eog/commit/48e971cb
-rw-r--r--src/eom-image.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/eom-image.c b/src/eom-image.c
index bb4c5b2..8e52832 100644
--- a/src/eom-image.c
+++ b/src/eom-image.c
@@ -632,10 +632,32 @@ eom_image_apply_display_profile (EomImage *img, cmsHPROFILE screen)
if (screen == NULL) return;
if (priv->profile == NULL) {
- /* Assume sRGB color space for images without ICC profile */
- eom_debug_message (DEBUG_LCMS, "Image has no ICC profile. "
- "Assuming sRGB.");
- priv->profile = cmsCreate_sRGBProfile ();
+ /* Check whether GdkPixbuf was able to extract a profile */
+ const char* data = gdk_pixbuf_get_option (priv->image,
+ "icc-profile");
+
+ if(data) {
+ gsize profile_size = 0;
+ guchar *profile_data = g_base64_decode(data,
+ &profile_size);
+
+ if (profile_data && profile_size > 0) {
+ eom_debug_message (DEBUG_LCMS,
+ "Using ICC profile "
+ "extracted by GdkPixbuf");
+ priv->profile =
+ cmsOpenProfileFromMem(profile_data,
+ profile_size);
+ g_free(profile_data);
+ }
+ }
+
+ if(priv->profile == NULL) {
+ /* Assume sRGB color space for images without ICC profile */
+ eom_debug_message (DEBUG_LCMS, "Image has no ICC profile. "
+ "Assuming sRGB.");
+ priv->profile = cmsCreate_sRGBProfile ();
+ }
}
/* TODO: support other colorspaces than RGB */