From c98314bc4d1ec5a1e1df3a43128ad382de3091e7 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Mon, 8 Jul 2019 17:14:12 -0400 Subject: Allow color correcting images with alpha channel This is mostly useful for PNG images for now but could also help with TIFF files in the future. LittleCMS will still ignore the alpha channel, so this should be harmless. https://bugzilla.gnome.org/show_bug.cgi?id=725357 upstream commit: https://gitlab.gnome.org/GNOME/eog/commit/80b536bc --- src/eom-image.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/eom-image.c b/src/eom-image.c index 8e52832..b4bf960 100644 --- a/src/eom-image.c +++ b/src/eom-image.c @@ -667,18 +667,17 @@ eom_image_apply_display_profile (EomImage *img, cmsHPROFILE screen) return; } - /* TODO: find the right way to colorcorrect RGBA images */ - if (gdk_pixbuf_get_has_alpha (priv->image)) { - eom_debug_message (DEBUG_LCMS, "Colorcorrecting RGBA images is unsupported."); - return; - } + cmsUInt32Number color_type = TYPE_RGB_8; + + if (gdk_pixbuf_get_has_alpha (priv->image)) + color_type = TYPE_RGBA_8; transform = cmsCreateTransform (priv->profile, - TYPE_RGB_8, - screen, - TYPE_RGB_8, - INTENT_PERCEPTUAL, - 0); + color_type, + screen, + color_type, + INTENT_PERCEPTUAL, + 0); if (G_LIKELY (transform != NULL)) { rows = gdk_pixbuf_get_height (priv->image); -- cgit v1.2.1