How to increase contrast between cloudy sky and snowy mountains?


Hi! I’m not a darktable newbie, but I’m not very good with it either. I have a couple of dozen pictures from a vacation where the sky is very overcast (raining at times) and blends in with the snowy mountains. IMG_3379.jpg is more or less what I would like the final product to look like, except I’d like to have more contrast between the clouds and the mountains.

I know there is some contrast to be had since if I stretch the image like crazy (at the expense of the rest of the image), there is clearly a good border between them (IMG_3379_stretched.jpg).

So, what I’m really after: increase the contrast between the sky and the snow.

I thought I might use darktable to select the sky with a parametric mask, then simply drop the exposure level on the sky to make it a bit darker. However, there is enough of a gradient in the sky that I can never separate the sky from the snow. I have not found a way to select a region by edge fitting (as in GIMP), but such a manual solution would not be ideal anyway since I would like to do this to several dozen photos.

Any suggestions for how I might tackle this? Either through masking or some other approach entirely? I can upload the raw (Canon 6D) upon request.

Thanks for any insight.

(Mica) #2

Use a drawn mask. Or export two versions and.combine them in gimp


How would I do that to accurately fit the edge of the mountain? In my attempts so far, I was not able to do anything other than relatively coarse, smooth fits with my drawing.

I can go the gimp route, I think, but I would still like to do it all within darktable if it is possible.

(Mica) #4

Zoom way in and use a small brush

(Boris Hajdukovic) #5

Hi @MikeRessler,

Yes, please.


Here is the raw. Thanks for having a look.
IMG_3379.CR2 (21.7 MB)

(Boris Hajdukovic) #7

An easy way is unknown to me. :worried:
Good results can be achieved as suggested by @paperdigits , with the help of drawn masks especially in combination with parametric masks.

For the demonstration, my try:

First I used the first curve to radically darken the sky and snow (gradient mask +parametric mask):


With the second curve I have lightened the rest of the image (inverted drawn mask):


Third curve served to increase contrast and saturation of the whole image. End result:

IMG_3379_03.CR2.xmp (12,6 KB)

(Tobias) #8

You can even paint a much more detailed mask. Here an quick example:


IMG_3379_02.CR2.xmp (7.1 KB)

(Thomas) #10

IMG_3379.CR2.xmp (6,9 KB)


Thanks for all your suggestions. I finally had a chance to play a bit more yesterday. While I was able to get closer to what i was after, particularly following Boris’s suggestions, in the end I wrote my own pseudo-edge detector in python. In short, I loaded the raw into python with rawpy, ran a 2-D Prewitt filter over the image to find the boundary between mountains and sky, dropped in the intensity of the sky area 12%, then saved it as a 16-bit PNG. I loaded that into darktable and applied the usual things (lens correction, sharpening, exposure, etc.). Current picture looks like this:

I’m not quite done, I have to bright up the foreground some more without losing contrast, but the sky is closer to what I’m after.

I guess for darktable to do what I’d like natively, it would have to have a mask option with edge-detection built in, something like a drawn mask where one of the selections was “edge”.

Thanks again - I appreciate your time and advice.

(pphoto) #12

That’s a quite good result. Since the sky looks very artificial and seems to be easily separateable from the hills I suggest to load the image in Gimp and replace the sky with a blue one.