GNOME Bugzilla – Bug 748749
picked colors don't match image colors when a color profile is active
Last modified: 2016-05-23 12:24:47 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"
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.
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.
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(-)
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(-)
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(-)
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.
(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.
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...
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.
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.
(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. :)