GNOME Bugzilla – Bug 725357
support for color correction of RGBA images
Last modified: 2014-03-03 22:06:47 UTC
Created attachment 270517 [details] [review] rgba.patch The current lack of does mostly affect transparent PNGs.
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);
(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.
Created attachment 270595 [details] [review] rgba.patch
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.
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 ;))
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.