Processing blue pixels and white pixels separately

BVQX5524.DNG (10.8 MB)
This file (BVQX5524.DNG) is licensed Creative Commons, By-Attribution, Share-Alike. It illustrates a problem I’ve had for years: Processing the sky.

First, let me state my concept for digital processing. I visualize the blue sky as an unblemished backdrop (or “layer”). Then, I visualize the white or gray clouds as a second layer. Of course, one issue is that the camera mashes everything together. This becomes a big problem when clouds are thin and blue sky shows through.

I’ve tried many times to isolate the blue-color pixels and make them a separate object inside GIMP (or RawTherapee). Maybe I’m doing it wrong? Or, maybe I expect too much.

I published a similar exposure online, but it’s a flawed compromise.

I know individual aesthetics are a strong part of this forum, but I’ll be paying special attention to anyone who has a workflow from which I can learn to work on blue pixels and white pixels separately.

Hello, I see you like strongly saturated colours.
Here is my try using haze removal twice, once on the whole image in details tab and once on the sky in the local tab. Plus in details tab tone mapping and contrast + chromaticity. Capture sharpening worked here too and improved sharpness.
I wouldn’t try to separate clouds from blue sky as layers, this sounds like creating many artefacts. Haze removal does a great job when it comes to boost contrast in almost homogeneous areas like the sky.

Probably you might even get more using HSV equalizer.

BVQX5524_RT-1.jpg.out.pp3 (16.6 KB)

Added: Here I fiddled a bit with HSV equalizer, based on the above image. In the lower part first artefacts appear in the sky.

BVQX5524_RT-3.jpg.out.pp3 (17.6 KB)

1 Like

For that particular scene in the GIMP, the blue and the clouds can be separated by luminance.
Duplicate Layer.
Convert to gray.
In Levels expand the sky histogram by raising the left slider value.
Then change the layer to pure Black and White with the Color>Threshold function.
What’s left is a sharp mask that can be used on the original and the inverse of the mask can be use to adjust the other.

Then merge down and get something like this:

Exaggerated to illustrate the method … there are many ways on the way to tone down the result.


Wow, I never thought of using haze removal! Or tone mapping!
Yours is a clear improvement!

1 Like

When used with care, haze removal can produce nice results, even if there is no haze at all :grin:

1 Like

You’ve given me several ideas. One of which is that I could create several versions of Color>Threshold and then blend/experiment.

Good luck! As the saying goes, “there are many ways to skin a cat”.

I’m playing with the GIMP’s ‘selection by color’ … not working too well so far …

With Gimp

You cannot really split between blue and white. You can use the blueishness of pixels to set their sensitiveness to your processing (so pure blue pixels get your changes in full, light blue ones get only partially affected). In other words, in Gimp parlance you want the selection to reflect the blueishness.

This is more or less what the “Luminosity mask” technique does, but using blueishness instead of pure luminosity.

Bluesihness itself isn’t the level of the Blue channel alone, because white is also the max value in the blue channel. Blueishness is the difference between the Blue channel and the two others. You can exporess this with the Mono mixer, duplicate your layer and start Colors > Desaturate > Mono mixer, and subtract the Red and Green channel from the Blue:


You get something like this:

You can use brightness/contrast to make the white fully white:

Open the channel list, and right click any of the R/G/B channels (they should be all identical) and Channel to selection.

Back in the Layers list, remove/hide the monochrome layer, select your initial image, and now the color changes apply to the blue pixels (here I used Colors >Hue-Chroma to lower the lightness and increase the saturation)


Good one, @Ofnuts !

My version…( Darktable ).

BVQX5524.DNG.xmp (15.4 KB)


I’ve just looked at another sky with clouds and found that extracting saturation seems to separate the blue from the clouds, at least in that particular image from a Foveon-based camera.

Just tried that and it worked quite well. Waiting for permission from the image owner to post the result here …

Starting with this:

I got this:

But when I tried the same on the thread subject DNG image, it really didn’t work because of the foreground content and the less clearly defined clouds. Ho hum.

1 Like

Often there is a smooth transition from the white clouds to the more or less blueish sky. This is why I think it is better to boost luma and chroma contrast, like haze removal seems to do.

I had to insert one step to match the example images in your mini-tutorial. Right after applying the Mono Mixer, Colors>Invert the image.

Otherwise, an interesting and useful exercise. Thank you!

I once long ago published a guide here but in Polish, which one of the participants translated into English.
It concerned the possibility of developing an image in L-a-b space.
GIMP - image correction in the LAB space .pdf

GIMP - image correction in the LAB space .pdf


BVQX5524.DNG.xmp (12.3 KB)
darktable 4.2.1

Updated attempt - finessed the masks to bring out more of the cumulonimbus behind the sports hall and to shift the clouds closer to white.

BVQX5524.DNG.xmp (15.5 KB)

1 Like

Wow, that PDF is amazing. Full of interesting ideas that I have never read before!

A very interesting detail in your version: I owned a 4x5 view camera when I was younger. I always adjusted the back, so that vertical distortion was corrected. The result was a more attractive appearance to the buildings and houses, just as you have done here.
(I used the Perspective tool in GIMP.)

I prefer to have the perspective as my eyes/brain see the scene - it just looks “right”.

In my opinion one of the superpowers of darktable: “rotate and perspective”

The issue is that depending on the attitude & azimuth of the subject - the stretching maybe too much to keep reasonable detail in some areas of the image. In some cases it is better to keep the camera level if you can and crop so that the amount of stretch is minimized and detail is consistent across the image.

I agree; the non-distorted lines are “right” and also correct, because the buildings do not actually taper.
Since the sky was the main interest, I had no choice but to point upward. Sad face.