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 748749 - picked colors don't match image colors when a color profile is active
picked colors don't match image colors when a color profile is active
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2015-05-01 12:27 UTC by dmitry1234
Modified: 2016-05-23 12:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
whacked rgb is still whacked (79.17 KB, image/jpeg)
2016-05-23 10:41 UTC, Elle Stone
Details
colors are wrong when using a monitor profile other than sRGB (84.85 KB, image/jpeg)
2016-05-23 10:55 UTC, Elle Stone
Details

Description dmitry1234 2015-05-01 12:27:00 UTC
try the following:
1. set the RGB profile to WhackedRGB.icc (can be obtained here: www.gballard.net/photoshop/pdi_download/PDI_WhackedRGB.zip and it is somewhere in the archive)

so, this is deliberately very wrong profile and all colors appear wrong (red as green, green as blue, blue as red)

2. paint anything with a red color (it will appear green)

3. pick a color - it still will be red in a color window and in a toolbox window


I believe that this is a wrong behavior, because the point of color management is to see the colors as it should be shown by the color profile and not as it is in the plain RGB numbers.

so, in my opinion, the whole color palettes and instruments should be repainted according to current color profile (as in Photoshop) so we will have literally "what you see is what you got"
Comment 1 Jehan 2015-05-04 06:06:09 UTC
Tested on GIMP master. I confirm that the color picker, as well as the foreground/background colors do not show the same color as what is actually painted. And I agree that it is not right.
Comment 2 Michael Natterer 2015-08-24 22:05:42 UTC
All "colors" as in GimpRGB values are floating point sRGB and should be
displayed as-is.

What needs to happen is that we need to convert from image pixels to GimpRGB
when picking colors, and convert from GimpRGB to image pixels when applying
colors to images.
Comment 3 Michael Natterer 2015-08-24 22:13:44 UTC
Step one towards fixing this:

commit 8c80ee14ff71a5773a94e58372579da04bffd1aa
Author: Michael Natterer <mitch@gimp.org>
Date:   Tue Aug 25 00:05:59 2015 +0200

    Bug 748749 - picked colors don't match image colors...
    
    ...when a color profile is active
    
    This commit doesn't fix anything, but it prepares the code to do the
    right thing:
    
    It passes the actual raw image pixels through the entire color picking
    mechanism to the widgets which display colors, particularly
    GimpColorFrame.
    
    This is needed for GimpColorFrame's "Pixel" mode (as opposed to its
    RGB, HSV etc. modes) which is supposed to show the raw pixel values
    from the image.
    
    Before this commit, it was recreating the raw pixel values from the
    GimpRGB value it knows, which will become impossible when we correctly
    pick color managed GimpRGB values soon.

 app/core/gimpimage-pick-color.c     |  6 ++--
 app/core/gimpimage-pick-color.h     |  4 +--
 app/core/gimpmarshal.list           |  2 +-
 app/core/gimppickable.c             | 57 ++++++++++++++++---------------------
 app/core/gimppickable.h             |  4 +--
 app/display/gimpcursorview.c        |  8 +++---
 app/pdb/image-cmds.c                |  4 +--
 app/tools/gimpcolorpickertool.c     | 31 +++++++++++---------
 app/tools/gimpcolortool.c           | 35 ++++++++++++-----------
 app/tools/gimpcolortool.h           |  8 +++---
 app/tools/gimpimagemaptool.c        | 18 ++++++------
 app/widgets/gimpcolorframe.c        | 56 +++++++++++++++++++++++-------------
 app/widgets/gimpcolorframe.h        |  8 ++++--
 app/widgets/gimpsamplepointeditor.c | 10 +++----
 app/widgets/gimpselectioneditor.c   |  2 +-
 tools/pdbgen/pdb/image.pdb          |  4 +--
 16 files changed, 135 insertions(+), 122 deletions(-)
Comment 4 Michael Natterer 2015-09-20 19:21:53 UTC
Almost there...

commit 9550fbff3cdfbd6ee037f880e0ec711be5b49275
Author: Michael Natterer <mitch@gimp.org>
Date:   Sun Sep 20 21:17:54 2015 +0200

    Bug 748749 - picked colors don't match image colors...
    
    ...when a color profile is active
    
    This commit adds more (still unused) infrastructure to fix this bug:
    
    Ee now keep around color transforms from layer pixels to "R'G'B'A
    double" (which is GimpRGB's format) and back. Also add utility
    function gimp_image_color_profile_pixel_to_srgb() which converts a
    picked pixel to GimpRGB, using the cached color transform.

 app/core/gimpimage-color-profile.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 app/core/gimpimage-color-profile.h |   9 ++++-
 app/core/gimpimage-private.h       |   5 +++
 app/core/gimpimage.c               |   5 +--
 4 files changed, 118 insertions(+), 7 deletions(-)
Comment 5 Michael Natterer 2016-05-22 21:31:14 UTC
Fixed in master:

commit 26251695b0542803d06e0d85b6d096ff116c95c8
Author: Michael Natterer <mitch@gimp.org>
Date:   Sun May 22 23:28:31 2016 +0200

    Bug 748749 - picked colors don't match image colors...
    
    ...when a color profile is active
    
    Add GimpPickable::pixel_to_srgb() which puts a picked raw image
    pixel into a GimpRGB. Default to gimp_rgba_set_pixel() but implement
    pixel_to_srgb() in GimpLayer, GimpProjection and GimpImage and
    run the pixel through gimp_image_color_profile_pixel_to_srgb().

 app/core/gimpimage.c      | 15 +++++++++++++++
 app/core/gimplayer.c      | 16 ++++++++++++++++
 app/core/gimppickable.c   | 35 +++++++++++++++++++++++++++++++----
 app/core/gimppickable.h   |  8 ++++++++
 app/core/gimpprojection.c | 20 ++++++++++++++++++++
 5 files changed, 90 insertions(+), 4 deletions(-)
Comment 6 Elle Stone 2016-05-23 10:41:00 UTC
Created attachment 328375 [details]
whacked rgb is still whacked

Use Change Foreground Color to select a red color. Painting on an sRGB image produces red, as expected. But painting on a whacked RGB image produces green. 

Now use the color picker to select the newly painted green color from the whacked RGB image and paint on the whacked RGB image - the resulting color is green. But painting on the sRGB image produces red.

Similarly with using Change Foreground Color to select a magenta color - painting on an sRGB image produces magenta as expected. But painting on a whacked RGB image produces yellow. But picking from the yellow color on the whacked RGB image and then painting on the sRGB image produces magenta.
Comment 7 Elle Stone 2016-05-23 10:44:00 UTC
(In reply to Elle Stone from comment #6)
> Created attachment 328375 [details]
> whacked rgb is still whacked

Sorry, I also experimented with changing the precision of the whacked rgb image to linear, so the color space just says the generic "sRGB TRC variant blah blah". But the bottom image in the attached jpeg really is in the whacked rgb color space.
Comment 8 Michael Natterer 2016-05-23 10:46:27 UTC
This bug is about picking colors, not painting with them :)

Check git master, I already added the infrastructure to convert colors
*to* the image's colorspace. Locally, I have quite some patches for
actually using that API, more commits soon...
Comment 9 Elle Stone 2016-05-23 10:55:19 UTC
Created attachment 328377 [details]
colors are wrong when using a monitor profile other than sRGB

If the color picker were color-managed, then in the attached jpeg the colors labelled 1, 2, 3, 4, and 5 would all match. 

But as shown in the attached jpeg:

Colors 1, 2, and 3 match each other and are neutral gray. 1 is the thumbnail, 2 is the image color, and 3 is my desktop background (I deliberately set the desktop background to match the image color).

Colors 4 and 5 match each other, but they don't match the image color, being slightly to the magenta side of neutral gray.

Choosing sRGB as my monitor profile of course does make all the colors match (well, except for the desktop background color 3). But then the image colors in GIMP would be displayed incorrectly.
Comment 10 Michael Natterer 2016-05-23 12:10:49 UTC
It picks the right colors now, it just doesn't display them properly,
that's what bug 467930 is about. Will turn that one from an enhancement
into an actual bug.
Comment 11 Elle Stone 2016-05-23 12:24:47 UTC
(In reply to Michael Natterer from comment #10)
> It picks the right colors now, it just doesn't display them properly,
> that's what bug 467930 is about. Will turn that one from an enhancement
> into an actual bug.

OK, understood! Picking the right color isn't the same as painting with the picked color, and also isn't the same as displaying the picked color completely correctly. :)