After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 725357 - support for color correction of RGBA images
support for color correction of RGBA images
Status: RESOLVED FIXED
Product: eog
Classification: Core
Component: image viewer
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: EOG Maintainers
EOG Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-02-27 22:55 UTC by pdknsk
Modified: 2014-03-03 22:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rgba.patch (823 bytes, patch)
2014-02-27 22:55 UTC, pdknsk
none Details | Review
rgba.patch (879 bytes, patch)
2014-02-28 20:08 UTC, pdknsk
none Details | Review

Description pdknsk 2014-02-27 22:55:55 UTC
Created attachment 270517 [details] [review]
rgba.patch

The current lack of does mostly affect transparent PNGs.
Comment 1 pdknsk 2014-02-28 01:43:08 UTC
Comment on attachment 270517 [details] [review]
rgba.patch

Index: eog-3.8.2/src/eog-image.c
===================================================================
--- eog-3.8.2.orig/src/eog-image.c
+++ eog-3.8.2/src/eog-image.c
@@ -708,16 +708,15 @@
 		return;
 	}
 
-	/* TODO: find the right way to colorcorrect RGBA images */
-	if (gdk_pixbuf_get_has_alpha (priv->image)) {
-		eog_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,
+				        color_type,
 				        screen,
-				        TYPE_RGB_8,
+				        color_type,
 				        INTENT_PERCEPTUAL,
 				        0);
Comment 2 Felix Riemann 2014-02-28 19:57:14 UTC
(In reply to comment #0)
> Created an attachment (id=270517) [details] [review]
> rgba.patch
> 
> The current lack of does mostly affect transparent PNGs.

Is that really sufficient? I was always under the impression that color correction with alpha channel would require taking the image background into account.
Comment 3 pdknsk 2014-02-28 20:08:56 UTC
Created attachment 270595 [details] [review]
rgba.patch
Comment 4 pdknsk 2014-02-28 20:18:10 UTC
The bKGD chunk is merely a suggestion to display transparent parts against.

http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html

The bKGD chunk specifies a default background color to present the image against. Note that viewers are not bound to honor this chunk; a viewer can choose to use a different background.
Comment 5 Felix Riemann 2014-03-03 18:37:07 UTC
I didn't mean the bKGD chunk.

As of now eog is color correcting images without taking the color/pattern of the backdrop the image will be composited with into account. This is no problem for RGB images. However, my impression was that this isn't correct for RGBA images and eog would have to color correct the final composited image instead in that case (which would be quite a task with the current drawing code).

Hmm, the patch doesn't seem to apply cleanly. Can you make a patch using git format-patch? (Adding your full name would be a nice extra too ;))
Comment 6 Felix Riemann 2014-03-03 22:06:47 UTC
Allright, just spotted in the lcms docs that it won't touch the alpha channel with this setting. So, this is probably the best we can do for now.

The path was just a stray newline. Fixed that and made the indentation match and pushed it. Thanks!

commit 80b536bcd2f08f314e10f47d3689283c7ae577a6
Author: pdknsk <>
Date:   Mon Mar 3 22:58:16 2014 +0100

    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
---
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.