Deep blue sky effect

I would like to introduce here a technique for darkening the sky in landscape shots, which is based on the use of the channel data itself.

The technique is described using my PhotoFlow editor, but the same steps can be certainly reproduced with GIMP or Krita…

The idea is based on the well-known fact that the red RGB channel is darker than the RGB average in blue areas.
Here is my test image, with the most basic processing:

This is how the Lab L channel (luminosity) looks like:

This is the RED channel:

and this is the B channel:

The next step is to compute the difference between the R and B channels, such that the negative values are represented with RGB values below 50%, and positive values are represented with RGB values above 50%. This can be easily achieved by blending the B channel with the R channel in grain extract mode:

Since the goal is just to darken the blue areas, everything which is above 50% is actually not wanted, because it would lighten the corresponding pixels when applied back to the original image. This can be easily cured by blending a uniform 50% grey layer into the grain extract layer, to obtain this:

The layer is now ready to be blended back with the original image in either overlay or soft light mode. This is the result of a soft light blend:

A contrast layer just before the soft light blend allows to fine-tune the strength of the effect.

The final touch is represented by a copy of the input image which is blended with the darkened one in color blend mode. It allows to restore the original color tonality of the sky, that might get shifted by the overlay/soft light bend.

Here is the final result (a bit exaggerated, to better see where we are going…), and the original RAW file:

_DSC8213.pfi (25.0 KB)
_DSC8213.NEF (15.8 MB)

The attached .pfi file contains a deep blue sky layer that can be easily saved as a preset and re-used for any other image.

If anyone is interested in the technique, I’ll be glad to give more details on the different steps and/or the structure of the layers in the .pfi file.

Thanks for looking and for any feedback!


EDIT: I have added the original RAW file, which I initially forgot…

1 Like

Sometimes I deepen the sky by modifying the purple content.

1 Like

@Carmelo_DrRaw Thanks for the tutorial. :slight_smile: Edit: I rewrote this post to make it more useful. I also apologize for using a development release, which might cause the XCF file to be incompatible with your setup.

Here is the XCF file for GIMP users to follow: (8.2 MB). Let me know if I made any mistakes, or if you have any questions. Clarifications:

  1. G+B+R comes from New from Visible with only Grey, I: Blue and I: Red layers visible.
  2. Modify the Opacity of layers Blend (overlay) and G+B+R to change the strength of the effect.

Original Image

Deep Blue Sky

Layer details (Blend mode)

GIMP Version

Thanks for the tutorial. Here is my attempt:



Here an alternative approach just using the Darktable colorzones module.

_DSC8213.NEF.xmp (1.8 KB)

1 Like

Wrote the G’MIC GIMP filter for this effect. It should be able to accept both 8 and 16-bit layers. This is my first time making a filter, so let me know if everything is okay.

Version 3

#@gui Darken Sky : fx_darken_sky, fx_darken_sky_preview(1)
#@gui : Strength = float(.75,0,1)
#@gui : Contrast = float(5,0,5)
#@gui : Blend mode = choice(0,"Overlay","Softlight")
#@gui : sep = separator(), Normalize = bool(1)
#@gui : Brighten = float(0,0,1)
#@gui : sep = separator(), Preview type = choice(5,"Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right")
#@gui : sep = separator(), note = note("Based on <i>Carmelo_DrRaw</i>'s tutorial:\n\n\nFilter by <i>afre</i>. Latest update: <i>2017-07-01</i>.")
fx_darken_sky :
  mode=${-arg\ 1+$3,overlay,softlight}
  -repeat $! -l[$>] -split_opacity -l[0]
    -if {iM>255} -/ 257 bit=1 -endif
      -s c -rm.. -remove_hotpixels.. 5 -guided.. .,1,{.01*255^2}
      -- -- {im} -min 128 -- 128 -* {(5+$2)/10} -+ 128
    -blend $mode,$1
    -if $4 -n 0,255 -endif
    -apply_curve 1,0,0,{ia},{ia+(sqrt(iv)*$5/2)},255,255
    -if $bit -* 257 -endif
  -endl -a c -endl -done

fx_darken_sky_preview :
  -gui_split_preview "-fx_darken_sky $*",$-1

Version 1

#@gui Darken sky : fx_darken_sky, fx_darken_sky_preview(1)
#@gui : Strength = float(0.75,0,1)
#@gui : Scale = float(50,0,100)
#@gui : sep = separator(), Normalize = bool(1)
#@gui : Brighten = float(0,0,2)
#@gui : sep = separator(), Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right")
#@gui : sep = separator(), note = note("<small>Based on <i>Carmelo_DrRaw</i>'s tutorial:\n\n\nFilter by <i>afre</i>. Latest update: <i>2017-06-25</i>.</small>")
fx_darken_sky :
  -repeat $! -l[$>] -split_opacity -l[0]
    -if {iM>255} -/ 257 bit=1 -endif
      -s c -rm.. -- -+ 128 -min 128 -adjust_colors 0,-{$2}
    -blend overlay,$1
    -if $3 -n 0,255 -endif
    -apply_curve 1,0,0,64,{64+(sqrt(iv)*$4)},255,255
    -if $bit -* 257 -endif
  -endl -a c -endl -done

fx_darken_sky_preview :
  -gui_split_preview "-fx_darken_sky $*",$-1

I think that here “the devil is in the details”… looking at the leaves above the clouds, I see in your result some visible halo. Is that a result of some additional sharpening, or does this come from the colorzones adjustment itself?

The presence of such artefacts is one of the main reasons why I tend to use the image channel data itself whenever I can: the results tend to be more natural, and transitions do not show strong artefacts (or at least less then when using masks and/or hue ranges).

Cool! I would just suggest to replace “Scale” by something like “Amount”, as this parameter effectively controls the opacity of the Overlay blend.

You might also want to give the choice between “Overlay” and “Soft light” blend modes, as they give slightly different results.

Newbie question: what is the purpose of the -apply_curve command? Is it some sort of gamma curve?

Here is another, more realistic example:


Darkened sky (and sea)

Definitely easier to understand because of all of the different subjects.

The overlay blend is controlled by Strength and the contrast by Scale. Is that confusing?

Hey, I am the newbie here! Since joining this forum, everything I have said and done has been new to me. Maybe I am just a fast learner. :smile: Simple: -apply_curve means apply curve. Brighten controls the amount values increase according to the standard deviation.

I will update the filter later. When it is okay and complete, maybe we can add it to GIMP.

thanks for the tutorial! Not quite as sophisticated, and so it probably breaks more easily than what you show, but here’s a quick way of doing it in RawTherapee.

Normal processing

With darkened sky

How I did it:


You are absolutely right. There are some awfuln halos in my example. However, when you are careful you can reduce the appearance of artefacts. See my second try, which shows only slight halos even at high magification.

I have no doubt that, with sufficient tweaking, there are many different ways to achieve a similar effect.

The main purpose of my example is to show how it is sometimes possible to “correct an image with the image itself”, by applying some simple algebraic operation on the channel data (here the difference between two channels applied back in overlay blend mode).

At the end of the story, the relevant parameters are how much time you spend to achieve a satisfactory result, and how natural and convincing the final result is… :wink:


  1. I rewrote my post for GIMP users to make it easier to follow and made the XCF file more accessible (smaller in size and won’t expire in 2 months :slight_smile:). The effect appears to be much darker than expected but you can change the Opacity of the Blend layer group to reduce it.

  2. I updated the G’MIC filter. Scale is now Contrast and there is an option to choose the blend mode. Might add more modes and features later. I noticed that the blend mode doesn’t affect the original sample image very much when it is linear 16-bit. I haven’t looked into why that is and whether that is supposed to happen.

    Feedback and questions welcome.

1 Like

Update 2

Yesterday I found time to update the G’MIC filter; fixed a few items. Note that it is not a carbon copy of @Carmelo_DrRaw’s method and will yield slightly different results. Additional features:

  • Accepts 8-bit and 16-bit source layers.
  • Reduces the noise introduced by the technique.
  • Allows you to normalize or brighten the result.

This filter is evidence that a recent complete newbie can contribute to the community :slight_smile:. I encourage people to give it a try ;). @Carmelo_DrRaw @David_Tschumperle If it is alright, I think this is ready to be included in the G’MIC GUI.


What seems to be missing in your script is a final, optional blend of the original image in color blend mode. This allows to nicely reduce the over-saturation often introduced by the overlay blend.

True. I totally forgot about that :blush:.

G’MIC doesn’t have the -blend color option per se. The GIMP docs say “Color mode uses the hue and saturation of the upper layer and the value of the lower layer to form the resulting image”, so it would be HS on the top layer and V on the bottom.

I tend to work in LCH space but L is different from V. Would using L instead of V be okay?

@afre, I’ve started writing a filter file for you: gmic-community/afre.gmic at master · dtschump/gmic-community · GitHub This is only a start, it could be nice to have your real name for credits and file name (as I did for others).

We can start like this : Now, you should be able to clone gmic-community and write pull requests, and if you write more filters in the future, I could add you as a gmic-community contributors.


@Carmelo_DrRaw, @afre, @David_Tschumperle, Just tested this awesome new filter with GMI’C 2.0.2 and he immediately became one of my favorites! Great job people! Thanks a lot for that!

1 Like