Blending colors using Gamma

Have you ever noticed that sometimes, when you mix colors in Photoshop or any other equivalent software, instead of getting a progressive change in the hue you get an intermediate state of a darker and estrange color? If you haven’t, try it. Open your editing software and create a white image. Select a big round brush with maximum softness and choose a bright red color. Now draw a line (straight, curvy… it’s all the same). You have a nice red line which blends softly with the white background. Now change to a neutral green color, and draw a second line that crosses de red one. You will see that the green, again, mixes well with the white background. The problem arises when both lines intersect.

Time for a physics class

Ok, I know you are lazy, so I did it for you. Here you can see the brown contour between the green and the red zones.

If you remember when you studied the visible spectrum of the light in science class (or if you don’t, just think on the rainbow, as they are the same thing) the scale of colors started on red, moved towards green and after that came the blue. Those are the three primary colors. The secondary colors, between them, were a consequence of a mixture of the three primary colors: yellow, between red and green, cyan, between green and blue, and magenta, between blue a red (an invented color by our brain to fill the gap that exists between blue and red). So having this in mind, we might expect that our mixture of green and red lines gave a yellow intermediate zone. Most probably you haven’t got this, but instead a dark and ugly brown color.

To explain this effect, first we need to understand how vision works. By the way our eyes and brain are made we don’t perceive luminosity in a linear way, but in a logarithmic one. This means that a slight increment in luminosity in a dark scene is perceived by the brain much more easily than the same increment of luminosity in a bright scene, where it might even go unnoticed. If this seems odd to you think about it a little bit: in a dark room where you see almost nothing, lighting a candle can bring enough luminosity to see all the surroundings with relative clearness, but lighting the same candle when the room is full of light makes almost no difference in what you perceive (you need a really bright light source to increase the sensation of luminosity of the room). Camera sensors, on the other way, don’t work in a logarithmic scale but in a linear one. They assign number 0 to the absolute darkness and 1 to their level of saturation, which means pure white. Any intermediate value transforms to the same intermediate amount of light received, so 0.5 means that the intensity is in the middle point between black and white.

To adapt their way of working to a more natural appeal, sensors usually convert their values to a logarithmic scale by taking the square root of the value, and storing it instead of the original intensity. This means storing more information in the dark parts, to which we are more sensitive, while storing less information on the bright parts, where we need higher differences in brightness to perceive a difference. The problem arises when you want to mix them and calculate an intermediate color. The correct way to do it is to square again the values, perform the operation desired and after that square the result again for storing it. What most software does is just apply the operation to the original squared value. And results between both methods differ in the way you have just seen.


Should I correct it or adapt to it?

So, the question is… If this method is wrong, why software keeps doing it this way? Does it mean that all people who design software are unaware of such simple problem? The answer is no, they are aware, and keep doing this on purpose.

Until this moment, we have thought about the color mixing process from the perspective of light: a red bulb and a green bulb mixed produce yellow light. But if you think on inks and pigments (just the opposite world of light, light bulbs are considered an additive system while inks are considered subtractive) the mixtures change. If you try to mix red ink and green ink, you won’t get anything close to yellow, but instead a kind of brown color that feels very similar to the brown that appeared on the mixture.

It happens that when photographers see the image and think about modifications, they don’t do it thinking about light being emitted but as inks being mixed. Because of that, the standard mode of the software is to simulate that methodology. When you mix the green and red lines, what Photoshop is interpreting is that you want to mix those two inks and create between them the color that would be created if you were painting an oleum (for example).

That is not wrong. Neither is right. It’s just subjective, as your way of thinking about it is.

On this case, the color has been calculated using the Gamma correction. You get a yellow halo instead of the dark brown one.

Other people don’t see color as a mixture of ink, but instead as a mixture of light. It is considered that for calculating the colors on the image they should be considered as light, and just at the moment of printing the correct mixture of inks for representing the color should be calculated. In this case, when I mix red and green what I expect is a bright yellow, not a dark brown. This is similar to considering the composition of the picture not as when painting with oleum but as if it was composed using little LEDs that illuminate each part of the image in the correct amount (that is exactly what your screen does to represent the colors).

So… correcting it or not is your choice, and depends on how you see the composing and modification process of the image. My recommendation is to try both and adhere to the one which most fits you and your way of processing. Both ways don’t affect the way the image is printed, but the way mixtures are calculated, so in both cases what you see is what you will get printed (assuming correct color profiles, correct screen calibration, correct configuration of the printer, etc.).


Ok… I want to solve it… for now.

If you decide to correct this behavior, or at least try it, it’s easy to do. In Photoshop you can find the option under the Edit menu, in the “Color Settings” option. In some versions you might also need to click on the “More options” button in the window that appears. In other software the option is usually with the rest parameters of color management, so it’s usually easy to find.

Just activating that option the colors will be calculated using the Gamma.

Once the window is open, we just need to activate the option “Blend RGB Colors Using Gamma”, with a value of 1.0. And that’s it.

You can try to draw a soft red line in a document and draw a green one before and after activating it, to see the difference. If you don’t like what you get, just deactivate it again. Something to be noticed is that the option affects to how colors are calculated, not how they are displayed. If you draw a line with it deactivated, the color is calculated as brown. If afterwards you activate it, the color is not recalculated or modified, and you won’t see any changes. You need to draw another line, and in that moment the colors of the mixture will be calculated for that line. In both cases the mixtures will be printed as you see them.

If you want more information, a nice explanation can be seen in this One Minute Physics Video.

Did you know about this issue? Do you have any consideration to comment with the rest of the visitors? If so, comments section is open, and I’d like to hear from you.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s