# Gray values different between grayscale and RGB color modes?

I'm trying to understand the different numbers I get when I convert an image from grayscale to RGB or vice versa. I'm only working with grayscale values at the moment as I'm working on a heightmap but I'll likely need the ability to add colors later.

I don't understand why 67% in grayscale goes to 42% in RGB. Shouldn't it be 33%? Is one of these color modes non-linear, and if so, is there a way I can make it linear?

I need to be able create a 25% gray and know that that's a quarter of my available altitude.

• One take into account that "color" is made by blocking white light that fall on black paint. The second is based on the fact that you take all three color sources on screen and light them in a manner to produce "gray". 42% is related to brightness of each color (255 steps of each. so it's 42% of 255). Commented Apr 6, 2020 at 8:46
• Note that the black and white is reversed. The second value corresponds to 58% in the other direction. (Which admittedly still is a difference.) Commented Apr 6, 2020 at 11:04
• Yeah, I expected it to be reversed, but basically 100 minus the same percentage. I'm pretty sure Grayscale is acting linearly, because if I copy a 20% gray out of another program, I get an 80% value in photoshop, and that at least makes sense to me. No idea what's up with RGB. Commented Apr 6, 2020 at 15:56
• It has to do with which gray Working Space you have chosen in Color Settings. It looks like you have chosen Dot Gain 20%. sGray seems to follow the brightness of a chosen sRGB gray 1:1. I'm looking forward to someone explaining the background in detail, which I'm not capable of. Commented Apr 6, 2020 at 16:22

## 1 Answer

You should be very very careful when doing any reasoning on color based on mathematical intuition.

First thing is. Your monitor is not linear! RGB color is not linear. And grayscale is not linear (dot gain can just be different than RGB, but be careful their black and white dont need to match) They are configured to be nonlinear to enable us to use 8 bit per channel color. Even the scientific color mode Lab isn't linear the way you think, its perceptually linear, which isn't the same thing. The whole expectation that the numeric values have some mathematically meaningful interpretation is just wrong.

Programs like Photoshop have 20 years worth of development for them to be what you see is what you get. This means that the very messy process of how human eyes and brains work is factored into this. Including nonlinearness of those systems.

Why would this be beneficial? Well, artists are traditionally humans. And they react to sensory stimulus. So when you have an artist the important bit is that they sense it correctly, numbers be damned.

But this does not fit your use case. That is fine Photoshop isn't even designed for your use case. Possibly you should be using something else like zbrush or mudbox. Anyway the real answer is that if your interested then you can do this all you need is to make a color profile and dot gain that is truly linear.

But beware monsters lie here! Now you are in trouble since you are fighting the purpose of your software. You need to know how to deal with every step from this point forward, in pgotoshop and your entire publishing pipeline there is a chance that any one of those things encodes your linear values in nonlinear. Which you are unlikely to want. Also it becomes problematic to show the picture for you since the interpretation is different from what you think. There is really no good solution here. Explaining everything here would be a good state of the art review for a PhD.