It's a good question that reveals some interesting things about CIE colorimetry.
A few observations:
1. The monitor profile is irrelevant as Mike points out. It's just simple math and it will be the same regardless of what display you are using. It would be an odd result indeed if you plugged in a black and white monitor and all your LAB to RGB conversions came out with equal R,G, and B numbers in the color picker to reflect the greyscale monitor.
Thank you for your illuminating (
) reply. My understanding is that RGB numbers are device-dependent, which is one of the reasons for working-spaces, that they standardize the numbers for a range of output devices. So the RGB value we read when we are in, say, Adobe RGB, will always be the same, irrespective of what monitor is connected, but the actual RGB numbers sent to the monitor will depend on the monitor. So there's a transform from working-space to output, using the monitor profile.
If that is the case then the RGB numbers that the color picker show will always be the same because these are the working-space numbers, but we will see different colors (or grays) depending on the monitor, as below:
Is that not the case? I know I'm being a bit picky, but it's only in an attempt to understand what's going on.
2. Negative RGB numbers may be, but are not necessarily imaginary colors, they are just out of the gamut of that RGB space. It's quite possible to convert LAB values of real colors into small RGB spaces and end up with negative values — they are still real colors.
I was going to say that I now understand that, but actually I don't. Surely RGB 0,0,0 means black, in whatever working-space you use. So I don't see how negative RGB numbers can make any sense (or indicate an out-of-gamut color). The same applies to devices, surely: RGB 0,0,0 means the blackest black that the device can reproduce and even if the black of device A is less black than the black of device B, going from device A black to device B black does not result in negative RGB numbers: it just results in a darker black (if the mapping allows for this), or in positive RGB numbers (if the mapping does not). Similarly, going from B to A, what will happen is that the A black will be less black and will show a range of device B blacks as 0,0,0.
To me, RGB 0,0,0 means an absence of the 3 primaries: in the physical world it would mean a completely flat spectrum in the visible space. Negative RGB values would mean that the spectrum was negative, which it surely cannot be.
I see no reason why LAB or XYZ should not have imaginary colors, or colors that cannot be seen by us (for example, the models could be extended to the UV or infra-red ranges). But RGB is for the real world, the world that we can see (not the one we can imagine), and the one that we can reproduce. We cannot see or reproduce a negative RGB number, so it cannot exist, real or imagined. We cannot represent UV or IR in any sort of RGB model ... it would have to be URGBI!
The negative RGB component will have to be set to zero or to a positive number.
So ... still confused.
3. It's not a bug in photoshop; it's the way the math actually works out. It helps to think about it in terms of LAB -> XYZ rather than LAB ->RGB. You have four conversions:
1. LAB[0, 127, 0] -> XYZ[ 5.7, 0, 0]
2. LAB[0, -127, 0] -> XYZ[-3.1, 0, 0]
3. LAB[0, 0, 127] -> XYZ[0, 0, -8.9]
4. LAB[0, 0, -217] -> XYZ[0, 0, 50.3]
CIE XYZ was specifically designed to avoid negative values. So examples 2 & 3 can be thought of as truly black in XYZ, but examples 1 and 4 are not. When you think about how the math works and how L* in LAB is tied directly to Y in XYZ which roughly corresponds to green/yellows it begins to make a little sense. To go from XYZ to a particular RGB space you will use the colorimetric intent find the nearest value on the solid formed by the primaries of the space. In examples 2 and 3 this will be the black point, but in examples 1 and 4 this will on the face of the solid or the red or blue axis of the solid depending on the space in question. When you then multiply by the conversion matrix will result in a non black RGB number.
Yes, that makes good sense and is an excellent explanation, thank you! I assume that the XYZ numbers will be set to 0 if they go negative. But what does XYZ 0,0,30 mean? It translates to Lab 0,0,-115 and RGB -25,15,145 (in ProPhoto). So this is a perfectly valid XYZ color, which translates to a perfectly valid Lab color ... but to a strange (read weird) RGB number. What Photoshop does is to set the RGB values to 0,15,145, so it is preventing negative RGB numbers. A more intelligent mapping would be to set the RGB values to 0,0,0 as this would give a black rather than a blue.
It would seem to me that it would have been a sensible and simple mapping algorithm to say that if L or Y is zero then RGB=0,0,0, irrespective of the maths.
I guess this is just the disconnect between maths and the real world ... but surely that means that the model is flawed (in which case it should be possible to correct it - and if the CIE will not, why should Adobe not do so?).
4. I'm doubtful that it would be helpful to limit LAB values to a working RGB space. When you are working in LAB mode, you are not in an RGB space and therefor don't have a working RGB space to use as a limit. If you want to work within the limits of an RGB space, use that space as your working space.
Well there are reasons for working in Lab, simply from an editing point of view (for example, some people think it's advantageous to sharpen only the L channel, color balance is probably easier to do in Lab ...). But in a program like Photoshop, which is used to produce visual output, surely the editing should behave in a rational way ... in other words, even if it makes sense to have colors with no luminance in Lab, it really does not when it comes to visual perception, and it makes even less sense for the color with no luminance to show as red or blue. Simply applying the working-space gamut to the Lab values will ensure that (and making Lab 0,x,y = RGB 0,0,0). This could be an option in Lab, so it would still be possible to work in imaginary colors or weird mappings for those of us who would like to.
At any rate, it is possible to use Photoshop's gamut warning if we soft-proof to the working space, which is at least something ... but not much as it only kicks in at around Lab 0,0,-28 so we can still get dark blues with zero luminance
Robert