Contrast Modes

Done using GIMP 2.10.24 on Kubuntu Linux 20.04 LTS

The next group of modes are the Contrast modes, and as the name implies they increase the contrast as the layers are combined.

Overlay

This has a complicated formula that starts by inverting the values of the pixel in the lower layer (Called I in GIMP documentation for Image), then multiplying the pixel values in the upper layer (Called M for Mask) by 2, then dividing that by 255, and then multiplying that times the inverted values of the lower layer. Then you add back the values of the lower layer, and then multiply by the values of the lower layer, and finally divide by 255. So what does all of that mean?

Equation for Overlay mode

To simplify the analysis, we can take just one channel instead of all three (R,G,B), and lets give that channel the value of 50 for the lower layer and 40 for the upper layer. Remember that lower numbers are darker, so these are fairly dark values. Inverting the value of the lower layer is 255-50=205. Twice the upper layer is 2×40=80, and then dividing that by 255 gives approximately 0.31. Then 0.31×205 is approximately 64. Add the lower layer value to that, and 64+50=114. Now multiply by that by the value of the lower layer and 114×50=5716. Finally, divide that by 255, the resulting combined pixel value is approximately 22. So the resulting value is lower than either of the layer values we started with.

Now let’s try some different numbers. The inverse of the previous example would give us 205 for the lower layer, and 215 for the upper layer. Inverting the lower layer gives us 50. Then twice the upper layer is 2×215=430. Dividing that by 255 gives us 1.69. Multiply that by the 50 from inverting the lower layer gives us 84.3. Then we add the lower layer to get 84.3+205=289.3. Multiply that by the lower layer is 289.3×205=59,309. Finally, dividing that by 255 gives us the final value of 59,309/255=232.5. In this case, we started with higher numbers, meaning brighter/lighter values, and wound up with something even brighter than either of what we started with.

From this you can see why this is an example of a Contrast layer mode, because it has the effect of increasing the contrast by making dark values darker and light values lighter. Looking again at the formula, you might see some resemblance to a few of the modes we looked at before. This mode is in some sense a combination of the Multiply (darken) and the Screen (lighten) modes. Using our two pictures, with the Toy as the top layer and the Dog as the bottom, we can see this increased contrast:

Two images combined using Overlay Mode

Soft Light

This is a complex equation, but the result is fairly easy to see. You first take the values you get from the Screen Mode, which is the values R-sub-S in the first equation:

Equation for Screen Mode

Then you plug that value into another equation:

Equation for Soft Light mode

But the actual effect is not hard to see. It basically does what it says, adds a soft light effect to the image. To demonstrate this effect, as well as show a really good use for it, I took the Dog image as a start.

Image of Dog after cropping

I picked this because it is fairly dark to begin with. Then I created another layer filled with White, and combined them using Soft Light mode, wth the White layer as top and the Dog layer as bottom:

Dog image after Soft Light mode

I think you can see that it is noticeably lighter, but still the same picture. You can reduce how strong the effect is by reducing the opacity of the top layer. If the opacity goes to zero%, you just get the bottom image unaltered.

Hard Light

This is very complex when you look at the equations, because it depends on the values of the pixels in the upper layer. Values above 128 get one formula, while values below 128 get a different formula. So just as with Overlay, the light values get even lighter, and the dark values get even darker, hence increasing contrast. To illustrate this, I took the same Dog image and the White layer, but this time I put the Dog image on top, and applied the Hard Light mode:

Dog image with Hard Light Layer Mode

In this case, the effect is like the dog is lit up by a powerful light. But note also that the dark areas are a little darker.

Vivid Light

Vivid light works off of the gray scale of the image, and applies a color dodge to pixels that are above 50% and a color burn to pixels below 50%, giving an effect somewhat similar to Hard Light. Here is a combined image using the Dog as the top layer and the Toy as the bottom layer:

Images combined using Vivid Light Layer Mode

As you can see, this produces a stronger contrast.

Pin Light

This is similar to Vivid Light by using gray scale values and dividing at the 50% mark, but where Vivid light applied Dodge and Burn, Pin Light applies the Lighten Only and Darken Only modes. Again, the effect is to increase contrast by making dark pixels darker and light pixels lighter.

Images combined with Pin Light Layer Mode

This looks very similar to the Vivid Light image, but when I look at the two images using the Difference Mode, I can see that they are different. One reason is that the middle of the gray scale tends to disappear with this mode. One way to see this is to use a gradient layer. I created one using a black-and-white radial gradient starting on the center with black and moving to white around the edges. I then set this to 50% opacity, and got this image of the dog:

Dog image with radial gradient in Pin Light Layer Mode

As you can see, on the right side of the Dog’s face the dark pixels are definitely darker, but the rest is washed out, and there are no mid-tones to speak of.

Linear Light

This also works off of gray scale, and is similar to Vivid Light, but instead of Color Dodge and Color Burn it applies Linear Dodge and Linear Burn .

Images combines using Liner Light Layer Mode

Combining the Dog Image with the same radial gradient I used for Pin light, I get this:

Dog image combined with radial gradient in Linear Light Layer Mode

Hard Mix

This mode operates on the three channels Red, Green, and Blue, and starts by adding the values in each channel. If the total is at or above 255, the value is set to 255. If the total is below 255, the value is set to zero. The effect is to “posterize” the image with pure colors.

Dog image with gradient combined using Hard Mix Layer Mode.

So for every pixel you can have pure black (000000), pure white (ffffff), the three primary colors such as Red (ff0000), Green (00ff00), and Blue (0000ff), and then the combinations of the pure primary colors, such as Yellow (ffff00), Magenta (ff00ff), and Cyan (00ffff).

That concludes our look at the Contrast Modes, and we have three groups to go. On the next tutorial we will look at the Inversion Modes.

 Save as PDF