Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
The "-sigmoidal-contrast" has fully saturated the red of the rose. While it is in LAB space, the tones are unchanged; only the a and b channels are changed.
When you convert the pixels to RGB (or sRGB; the effect is the same), all the fully-saturated red tones become the same colour: rgb(255,0,0). You can see this by inserting "-write x.png" after "-colorspace RGB". Convert that back to LAB, and these become the same grey tone.
In general, with integer arithmetic, there isn't a 1:1 mapping between colorspaces. There will be times when two or more pixels that are different in one space map to the same colour in the other.
Put it another way: your second command (case1) gives the same channel L as your first (placebo). This shows that changing a and b (in this case, increasing saturation) has no effect on L.
What is different in your third command (case2)? You convert to RGB, then back again to Lab. That is the only difference to the second command, so logically this is where the tones are being changed. If you change "-colorspace RGB" to "-colorspace RGB -write x.png", and look at x.png, you can see what has happened.
snibgo wrote:That is correct. (Except that they are called a and b, not A and B.)
And I thought "fully saturated" have different implications in "Lab" and "RGB".
Under "Lab", no matter how we manipulate "a" and "b", "L" should not be affected.
Even if it is converted to 8-bit RGB and got rounded or truncated, it should not change the overall "brightness".
henrywho wrote:Under "Lab", no matter how we manipulate "a" and "b", "L" should not be affected.
Correct. It shouldn't and, as far as I know, it isn't.
henrywho wrote:Even if it is converted to 8-bit RGB and got rounded or truncated, it should not change the overall "brightness".
No. Lab can represent colours that RGB cannot, such as different tones of fully-saturated red. When you convert these colours to RGB, you have to lose something -- either the full saturation or the tones.
henrywho wrote:Even if it is converted to 8-bit RGB and got rounded or truncated, it should not change the overall "brightness".
No. Lab can represent colours that RGB cannot, such as different tones of fully-saturated red. When you convert these colours to RGB, you have to lose something -- either the full saturation or the tones.[/quote]
Yes, I have to lose something, but that should be rounding, truncation or limiting. NOT overflowing to overall brightness
Using integer arithmetic, what is eleven divided by ten, multiplied by ten? Ten.
What is nineteen divided by ten, multiplied by ten? Also ten.
Two different numbers have both done the round trip, yielding the same result. That is what you are seeing. You could say the tones have shifted, but that is because a load of different colours (in Lab space) map to one colour (in RGB space), so the return trip to Lab space also creates just one colour.