From 28544c2266388d0df5f0824d0de45a2dc3382f02 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(-) (limited to 'src/eom-image.c') diff --git a/src/eom-image.c b/src/eom-image.c index f173a2f..f8add9d 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