HighlightReconstruction PlugIn


The HighlightReconstruction plug-in is part of the basic group. By default it is switched on and there is no reason to change settings or to switch it off.

This page is correct for the following stable versions of darktable
  • all (1.1.2 used for this description)

Reasons for use

Your camera uses a Bayer pattern to make the camera chip sensitive to color. The Bayer pattern consists of red, green and blue filters in front of the sensor to generate pictures with RGB components. For technical reasons the green filters put the lowest attenuation to the light compared to red and blue channels. A white light results on a (much) higher signal of the green channel than the red and blue channel. The white balance plug-in takes care that the picture you take will show the right colors finally. It does this by amplification of the red and blue signals at the output in order to balance the resulting sensitivity of all three color components to the same sensitivity. To verify this, go to the white balance plug-in and set the preset to passthrough. Red, green and blue channel are set to 1.000 and the picture shows a green mask. Setting the preset to camera white balance the green channel remains at 1.000 and the red channel (e.g. 2.300) and the blue channel (e.g. 1.500) are amplified to balance the colors.

The output signal of the RGB channels increases with increasing brightness. The green channel will reach saturation before the red and blue channel. At this point clipping of the highlights starts in the green channel. Following scenario visualize the effect of clipping in the green channel. Basis is a medium grey (HMTL notification in hex 96-96-96 or in dec 150-150-150). Increasing the brightness in all three channels (HTML notification in hex to dc-dc-dc or in dec 220-220-220) results in a lighter grey. Let us assume that clipping in the green channel starts at hex value 96 (dec 150). Increasing the brightness will result to magenta color (HTML notification in hex dc-96-dc or in dec 220-150-220). The simulation with the gimp color chooser shows the resulting colors.

The effect of magenta highlights can be verified also in darktable. The following pictures were taken on a river in winter showing some ice and the moving water around. The two photos on the left are overexposed by mistake by one f-stop. In darktable the exposure was reduced by -1 EV. The Highlight Reconstruction is on for the first picture. The 2nd picture is a duplicate of the 1st picture with the Highlight Reconstruction switched off. The highlights on the ice changes into magenta.

The 3rd picture shows the same scene with correct exposure already in the camera. The 4th photo is a duplicate of the 3rd photo with Highlight Reconstruction switched off. The 4th photo shows no magenta because of the reduced brightness at correct exposure level the green channel didn't reach the clipping value.

What this plug-in actually does

When mode “clipping highlights” is selected the plug-in avoids that the value of the red and blue channel increase when the green channel is already saturated and started clipping. In reality the algorithm analyses highlights if at least one channels is clipped and limit the other channels accordingly.

The mode “reconstruct in LCh” analyses each pixel having at least one channel clipped and transforms the information in LCh color space to linearly mix the channels.

Parameters that can be changed

Within the plug-in you have the choice to to select between two methods:
  • clip highlights
  • reconstruct in LCh
    and to set the clipping threshold

A preference for one or the other methods can not be given. I didn't not observed visible differences in both methods up to now.

The tool tip for the clipping threshold recommends “manually adjust the clipping threshold against magenta highlights (you shouldn't ever need to touch this)”. This confirms that the clipping is closely linked to the physical characteristics of the sensor and the Bayer pattern.

If no channels are clipped there is no negative impact on your picture if the Highlight Reconstruction plug-in is switched on. There is no reason to switch it off.

Example usage

See section reason for usage above.



See also

darktable online user manual chapter 4.5.6
darktable blog magenta highlights

Source code

darktable/src/iop /highlights.c

highlight_reconstruction-plug-in.png (4.9 KB) Joerg Hoeben, 02/03/2013 04:18 PM

magenta_demo_1.png (3.11 KB) Joerg Hoeben, 02/03/2013 04:18 PM

magenta_demo_2.png (289 KB) Joerg Hoeben, 02/03/2013 04:18 PM

Also available in: PDF HTML TXT