HDR Cookbook - Fixing Uneven Luminance -  featured - 01

HDR Cookbook – Fixing Uneven Luminance

Silent Conversation (HDR)The HDR process can lead to uneven luminance in areas of the image that are really supposed to have a very even look. The most prominent example of this is the sky: If you have blue sky with an occasional cloud in it, and if you used some more aggressive tonemapping settings, the sky round the clouds is darker than the rest of the sky. Essentially, this is a halo effect similar to the usual lighter halos. It leads to the sky having an unnatural look with lighter and darker areas. One method that can be used very effectively for fixing this is related to the Color Channel selection method introduced in the”Complex Selections” section and the method explained in the section “Reducing Halos”.

Notre Dame de la GardeAnother variant of this uneven luminance effect appears e.g. in buildings of which one part is photographed against the sky (very bright) while another part has, for example, some trees (rather dark) as background. In this case, the building (e.g. a tall tower) appears bright at the bottom and dark at the top. So the luminance within this building changes from top to bottom, creating a strange unnatural look. I will explain methods for both cases in the following.

Requirements and Assumption

I assume that you are working in the RGB mode because we need the color channels for creating a layer mask.


In principle, we will do the following:

  1. Create a Levels adjustment layer and raise its Gamma setting (brighten the image)
  2. Create a layer mask for this Levels layer that reveals the dark spots (they are brightened) and covers the brighter spots (those that do not need and brightening). We will use the Blue color channel for this.
  3. Modify the layer mask (increase its contrast and brightness) as well as the Levels layer’s Gamma setting until we get an evenly bright sky.

Detailed Process

As I explained in the introduction, there are two general cases which require evening out the luminance. I will explain solutions for both in the following.

Fixing Uneven Luminance in the Sky

The luminance of each color is represented in the respective color channel. Hence, the Blue channel represents the luminance of the blue color, which is what we want to fix.

  1. Start by selecting the blue sky in your image and turn this selection into a mask (see “Complex Selection”).
  2. Create a group called “sky” and move the mask to this group (simply drag the mask with the mouse). This gives you a nice container for manipulating the sky that limits all the processing done within the group only to the sky.

    Layer mask on the sky

  3. Now, create a Levels adjustment layer inside the “sky” group and set the Gamma value of this Levels layer to a value between 1.2 and 2.5 depending on how much brightening you need. Don’t worry, this is only a coarse starting value that will be refined later on. This setting will brighten the entire sky.
  4. Next, we create a mask in order to limit this brightening effect to the parts of the sky that are too dark. In order to do this, first remove the white layer mask of the new Levels layer by dragging it onto the trash bin symbol at the bottom of the Layers palette.

    A Levels layer masked with the inverted blue channel for brightening

  5. Go to the Channels palette and Ctrl-click on the Blue channel. This creates a selection.

    Blue channel

  6. Go back to the Layers palette and click on the new Levels layer. Turn the selection into a mask using the “Create layer mask” button. Your new Levels layer now has a layer mask that looks exactly like the Blue channel.
  7. Activate this mask (click on it) and press Ctrl-I to invert it. Now those parts of the Levels layer where the tones are darkest in the original image will be covered by the mask while those parts where the tones are darkest are revealed.
  8. Go to the Levels layer and adjust the Gamma parameter until the luminance is even throughout the sky.
  9. Sometimes the contrast in the mask is not high enough, resulting in suboptimal results. In this case, activate the mask and press Ctrl-L to start the Levels tool. You can now increase the contrast of the mask (turn the whites even whiter and the blacks even blacker). Play around with the settings until you get the desired result. Also play with the Gamma setting of the Levels layer to tune the darkening effect. Additionally, you may need to apply a little Gaussian Blur (use the Gaussian Blur filter from the Filter menu) to make the edges less rough and creat smoother transitions.

    Inverted blue channel mask with increased contrast and some Gaussian blur applied

  10. If the sky is too dark in the end, simply create another Levels layer in your “sky” group and adjust the overall brightness using this new Levels layer. Below, you see the complete sky group containing our Levels layer for evening the luminance (Levels 3), a Levels layer for tuning the overall brightness (Levels 2) and a Saturation layer for tuning the colors.

    Complete “sky” group

Comparison – Before and After

Here is a comparison of the photo before and after our treatment. Note that the rest of the photo ( the heads etc.) remains the same. Also note that I have applied some vignetting on purpose. Hence the darker edges on both pictures. You can see clearly that the darker areas around the cloud in the center disappear after the treatment.

Before the treatment on the sky

Afer the treatment on the sky


  1. Depending on the image, you may also darken spots in the sky that are too bright. The process is essentially the same. However, you do not need to invert the layer mask created from the color channel and you decrease the gamma of the Levels layer instead of increasing it.
  2. Do not overdo the evening of the luminance! In the extreme case, the sky appears as a solid blue area just as if you created a blue fill layer and blended it with the foreground. This also does not look very natural. Try to find a good compromise.

Fixing Uneven Luminance in Tall Objects

For dealing with the problem of uneven luminance, e.g. in a tall building, as it was explained in the introduction of this section, I use a different method. This method is based on the gradient tool. The nature of this type of uneven luminance is very different from the one in the sky in that it is simpler.

  1. Again, we create a group first: Select the building and create a mask from this selection. Create a group and drag the mask to this group with your mouse.

    The group for the building

  2. Now, create a second group inside the first one. The first group limits any adjustments we make to the building. For the second group we will create a mask that covers the lower (brighter) part of the building and reveals the upper (darker) part. We call this group the “gradient” group.
  3. But first, crate a Levels adjustment layer inside the “gradient” group and adjust the Gamma of this Levels layer to about 1,15 (lighter). This will make the whole building appear lighter.
  4. Now, click on the “gradient” group and create a layer mask for it. Select the gradient tool from the Tools palette and select a simple linear gradient. Position your mouse at the top of the image, Shift-click and drag the mouse down. When you release the mouse button, your mask will turn white at the top and black at the bottom with a smooth transition between the two areas. Pressing the Shift key while dragging ensures that the transition will be absolutely horizontal. You have to make a few tries before the gradient is exactly as we need it. Check the result on the screen: If you got it right, the upper part of the building should be as bright as the lower part.
  5. Usually the colors are now less saturated at the top. To fix this, just create a Saturation layer inside the “gradient” group and increase the master saturation until this effect vanishes. You will need some fine tuning of the Gamma, the saturation and, last but not least, the gradient mask before the result is perfect. Below, you see the complete group of adjustment layers (marked orange) inside the building group.

    The complete group for fixing the uneven luminance

  6. DONE

Comparison – Before and After

Here is the comparison again:

Comparison – left: before the treatment and right: after the treatment


10 HDR Top Tips for FREE!
Join our newsletter to get this eBook and step up your HDR skills today!
You will receive: The free eBook + our regular email newsletter with updates, news, tips and tutorials… all for free!
100% Spam-Free - Easy Unsubscribe

Leave a reply

3 Comments on "HDR Cookbook – Fixing Uneven Luminance"

5 years 6 months ago

I just used your technique to solve this problem and it worked very well. Thanks for posting.

5 years 5 months ago

Hey, this works for removing shadow from skin too.