Avoiding edge effects with shadows and highlights

I’ve discussed how to use the darktable shadows and highlights module on this blog before.

However, as I mentioned then, it can suffer from edge effects. Because the module looks at a region surrounding each pixel, you can get “halos” in regions that have a high contrast transition from light to dark.

I struggled with this problem recently while editing a photo that I took on New Year’s Eve of Admiralty Arch in London. The sun was behind the Arch, so I ended up with a bright, backlit sky, and a dark, shadowy building.

The shadows and highlights module did a good job of recovering both parts of the picture, but I was left with a pretty nasty halo:

shadows and highlights module halo
shadows and highlights module halo

I left the module on, but turned down the highlight recovery, and switched to the contrast brightness saturation module. There I knocked down the brightness to recover the sky.

Unfortunately, this module affects the whole image, not just the sky. To selectively apply the module, we ned to go down to the “blend” option and choose “drawn and parametric mask”. I drew a box around the sky, and find tuned the selection parametrically with the “L” (luminosity) slider.

darktable mask settings
“dran and parametric mask” settings. Note the adjustment to the input slider, selecting only the bright parts of the picture (sky).

This created a very sharp selection at the edge of the sky. The mask is shown in yellow in this image:

darktable mask
Using a mask (yellow) to select just the sky.

The result is:

No halo
Halo gone.

This principle is essentially the same as that used to blend multiple exposures in GIMP.

This is the final photo:

Admiralty Arch
Admiralty Arch

Leave a Reply