AdSense Mobile Ad

Showing posts with label layer. Show all posts
Showing posts with label layer. Show all posts

Thursday, December 8, 2011

Smoothing the Skin Reducing Local Contrast Using Layers

In a previous post in my Lightroom series I took advantage of the Clarity tool to smooth the skin of the model. Nevertheless, the Clarity tool is not available either in Photoshop or The Gimp and many people ask how the same effect can be reproduced in these programs.

I answered this question in a previous post (Clarity Adjustment in Photoshop). The answer, however, was pretty theoretical so that in this post we will use the technique we learnt to smooth the skin in an image.

The original image, once more, is the following:

Original Image (Cropped)

The first thing we're going to do is creating a new layer duplicating the original one. Once we've done it, we use the High Pass filter to detect the transitions. The radius you need to use depends on the image (and corresponds to the amount of local contrast we're going to detect). In this image of 16 megapixels I'll use a radius of 3 pixels:

High Pass Filter - Radius: 3 pixels

We end up with a neutral grey layer where transitions are marked by lighter and darker pixels whose intensity will depend on the corresponding (underlying) pixel:

High Pass Layer

We know from our previous post that the information contained therein can be used both to raise or reduce the local contrast of our image. Since, in this case, we want to reduce it, we have to invert the layer end we end up with:

High Pass Layer - Inverted

If we now set the blending mode to this layer to Overlay the result is the following:

Resulting Image: Lowered Local Contrast

What has happened? The neutral gray pixels leave the underlying pixels unaffected. Lighter ones will screen the underlying pixels and dark ones will multiply the underlying pixels. Since pixels aren't neutral gray only at the point of transitions, we would end up with increased local contrast. However, since we've inverted the high pass layer, the local contrast is reduced.

The skin now looks smoother and you can use the high pass radius to fine tune the smoothness. However, eyes aren't sharp any more and this is something we want to avoid. Now, we have to apply this local contrast reduction only locally. How? Using a layer mask.

A layer mask is literally that: a mask, and it behaves as such. Let's imagine you take a sheet of white paper and you print your original layer over it. Now, you take another sheet of paper and you print the high pass layer over it. If you put this sheet over the other in overlay mode (assuming it would be possible), you end up with the result we just achieved. Now: you take scissors and make a couple of holes in the upper sheet just where the eyes of the model are. What would the result be? Well, the eyes from the inferior layer would be visible and wouldn't be affected by the upper layer.

Layer masks work just like that: the only difference is that you make "holes" using the black color. Layer, moreover, are more sophisticated: you can make "semi-transparent" holes using a shade of grey. Funny, isn't it?

Let's add a layer mask to our inverted high pass layer:

Layer Mask

As you can see, the layer mask is white: this means that the entire layer now contributes to the overlay effect with the lower layer. Let's now take a brush and paint over the left eye and its eyebrow. The result is:

Right Eye and Eyebrow Unmasked

As you can see, the right eye and its eyebrow have recovered all of their local contrast: pixels that we painted with black aren't affected by the upper layer any more. Let's finish painting and we end up with this result:

Final Result

You can also notice how the layer mask icon in the layers palette reflects our mask:

Resulting Mask

Conclusion

Although not available as a standalone tool, you've learnt how you can reduce the local contrast (a negative clarity, in Lightroom jargon) of a selected part of your image.

Layer mask are powerful and you can use the same technique to selectively apply any kind of effects. In this case, you could have chosen to use a blurred layer to smooth the skin, instead of going through the steps described above. Or, you could have used a bigger radius to soften the skin even more, as shown in the following picture. The only limit is your imagination.

Result with High Pass Filter, Inverted, Radius: 5 px 

With the same technique, you can enhance the eyes of the model (as described in the Lightroom tutorial), applying the same adjustments in a new layer and masking out the parts of the image you want to leave unaffected.

If you want to help me keep on writing this blog, buy your Adobe Photoshop licenses at the best price on Amazon using the links below.

Exposure Compensation in Post Production Using Layer Blending Modes

Very often I hear people complain about what should be, apparently, a very easy thing to do: modifying the exposure of an image in post production. Truth is that if the adjustment you need is relatively small results are going to be satisfactory. Unfortunately, as long as you need to push the exposure adjustment a bit farther, results are often going to disappoint you.

Why?

Usually because of two factors:

  • Your image has not sufficient dynamic range to achieve the result you want (that's why you should shoot RAW if you can).
  • Because people don't clearly understand the physics of the human eye.


As far as it concerns the first factor, you cannot help but repeating it over and over again: you should shoot RAW if you can. Double check it. Even if you think you cannot. Some Canon point and shoots, for example, can be tweaked to shoot RAW.

As far as it concerns the second factor, here is yet another quick wrap up.

A Word of Warning: I'm a mathematician but if this is not a rigorous post. This is a quick tutorial for you to better understand some tools that are often misunderstood.

The Human Eye as a Sensor

As we stated many ways, one of the things that photographers often overlook is that the human eye is a logarithmic sensor. But what does it mean? It basically means that whenever the quantity of light doubles, whichever its frequency in the visible spectrum, you'll notice a comparable "brightness" improvement.

This also means that if you need to modify the exposure in post production, you cannot overlook this effect. You cannot just bump the channels up and down because luminance ratios must be preserved. If you don't, the dynamic range of your image will suffer and you'll end up with a flat, hazy image.

The Problem with the Brightness Tool

The problem with the Brightness tool is that, despite the name, it is not suitable to apply such a modification. It depends on the tool you're using but as far as it concerns the software most commonly used (Photoshop and The Gimp), a brightness adjustment does not what you think it does.

Roughly speaking, the brightness adjustment just adds a correction to the pixel values:

n = o + d

where o is the old value and d is the selected brightness adjustment. It might look right, doesn't it? It does shifts the histogram left or right (depending on the sign of d). But it does not preserve ratios and, as such, it is not the tool you need to tweak an image exposure preserving its dynamic range.

Here's what happens trying to fix an artificially underexposed TIFF image using just the Brightness tool (in this post I'll use The Gimp):

Original Underexposed Image

Brightness raised to 100


This test image is badly underexposed but the detrimental effect introduced by the Brightness adjustment on an image dynamic ratio won't ever be avoided.

If you like Mathematics, try to bring d to infinity and think at what happens to the (absolute value of the) ratio between two pixels value: it just goes down to 1. That's why your images will soon start to lose contrast.

Many people will then try to fix the contrast but that won't work, either.

What Can Be Done?

Preserving the ratios! To preserve the ratio, you need to correct a pixel values using a multiplier. That's what the Multiply and Screen blending modes are made for:

  • If you need to lower the exposure of your image, you can blend a layer with a copy of itself using the Multiply blending mode.
  • If you need to raise the exposure of your image, you can blend a layer with a copy of itself using the Screen blending mode.


What do these blending modes do?

Basically, they're effect is:

  • Screen lightens a pixel in the lower layer proportionally to the "brightness" of the corresponding pixel in the upper layer.
  • Multiply darkens a pixel in the lower layer proportionally to the "darkness" of the corresponding pixel in the upper layer.

What happens if you blend a layer with a copy of itself using these blending modes? It applies the very effect we were looking for!

Again, if you like Mathematics, just think about the definition of the exponential function. What happens when you're modeling a phenomenon whose variation (derivative) depends solely on its intensity? Refine this concept: is there any function whose derivative in a point x is only a function of the value of the original function in the point x? Yes: the exponential function.

We're applying an exponential transformation on a matrix of points that will be fed in a logarithmic sensor (the human eye). Just what we were looking for.

Here's what happens when we screen the test image we used before with itself (twice):

Screen Blending Mode

This is a much better result indeed.

If you're new to layers and blending modes, well, it's time you get serious about them. Here's a screenshot of The Gimp layer palette of the previous image:

The Gimp - Layer Palette

Conclusion

The Brightness and Contrast tools are often misused and it's important you understand what's going on under the hood. If you need to apply an exposure compensation, they're not the right tools. Instead, take some time to learn about layer blending modes. The Multiply and the Screen blending modes are just the beginning. Here are some additional tips:

  • You can mix and match them to achieve more sophisticated results and you can fine tune the effect tweaking the layer transparency.
  • If screening or multiplying two layers is too much compensation for your image, just make the layer a bit more transparent.
  • If you're looking for a way to raise the overall contrast of an image, try to screen and multiply it.
  • You may also want to take a look to the Overlay blending mode, which is a mix between the Screen and the Multiply (it screens dark colors and multiplies bright ones).


If you want to help me keep on writing this blog, buy your Adobe Photoshop licenses at the best price on Amazon using the links below.