Refined Unsharp Masking for Local Contrast
This tutorial is done in Gimp, but the basic ideas could be applied in any other layer based software (like photoflow, etc…)
Original Image
Notice that all images shown in this tutroial, except the original image here, were resized for faster upload speed. The original is in it’s original size so that you can use it in case you want to try this yourself.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
What we need
For this tutorial you will need a basic luminosity mask and a detail mask stemming from the unsharp mask process.
For the luminosity mask follow the steps in this awesome tutroial by @patdavid until you have your L mask.
To get your detail mask do the basic unsharp masking:
- Copy your base image
- Blur your base image. In this example I chose a radius of 100.
- Set the blurred image to grain extract.
- Create a new layer from visible. (you might just cancel the blurred image.)
- Desaturate the layer.
This new layer is your detail mask, which I’ll just call mask from now on.
Let’s start masking
If you look at it’s histogram, you can see it is centered around neutral gray and has some slightly darker and some slightly lighter parts. Using this layer in grain merge mode will darken the original image where the mask is darker than neutral gray and it will lighten the original image wherever the mask is lighter than neutral gray.
So let’s set it’s layer mode to grain merge to see it’s effect on the original image.
You should now see, that it has added a lot of local contrast. Too much actually. It doesn’t look very pleasing and there are positive and negative halos visible. What I like to do generally is to add local contrast or sharpness to the dark part of an image. So lets start by doing this here as well.
Duplicate the mask, we will need this one later, and call this one “lights”. Add a luminosity mask to the first mask, which we will now call “shadows” and invert it. Now the added contrast is only visible in the darker part of the image.
It’s nice but there are still some problems. For example this image has some areas which are already quite dark. Adding local contrast in these areas will push some of the dark parts even closer to black. As I don’t want this to happen I will now select only the part of the mask, which is brighter than middle gray in order to only add some “highlights” in the dark parts. This will also get rid of some negative halos. You can do this by using a curve on the mask itself looking like this:
Using our “shadows” mask on the original image should now get you this:
You might want to donwload the original image and the one above to compare as the differences are quite subtle.
Now we could do the same to the brighter part of the image. Use the mask called “lights” in grain merge mode and add a luminosity-mask. This should look like this:
Again we see the problems mentioned before. There are some positive halos (see the tree tops to the left) and some of the already quite bright parts are pushed even further towards white. This time we’ll use the same curve tool on the mask as before, only that this time we select only the parts of the mask, which are darker thatn neutral gray, as we just want to add some “shadows” to the bright parts of the image.
Here’s the curve setting:
And here is the image with only the “lights” mask active.
Activating both masks, “lights” and “shadows” will give us our final image.
Your layers in gimp should look somewhat like this:
Now in this image the effect is more visible in the darker parts of the image as there is more contrast in those areas and the unsharp mask only heightens contrast where there already is. If you want your masks to add even more local contrast you can just duplicate them or use the curves tool to add some contrast to the mask itself.
I hope you enjoy this little tutorial.