Editing photos with the darktable base curve

Curves are incredibly powerful photograph editing tool. They allow you to adjust the intensity and tonal values of the image with a few clicks, recover shadows and highlights, and boost saturation and contrast. However, they are also more complicated than similar tools such as levels. In this post I’m going to run over the basic steps of the curves using the darktable base curve and tone curve modules.

Why do we need curves?

In a RAW file the colours are linearly related to the photon intensities hitting the digital camera sensor. For example, if twice as many photons hit a sensor, it will record the scene as twice as bright. An 8-bit sensor can encode 256 levels. Level 200 is twice as bright as level 100.

However, the eye does not see perceive light intensity in a linear fashion, but rather in a logarithmic fashion.

Logarithm plot (Wikipedia)
Logarithm plot (Wikipedia)

In other words, a light source needs to give off much more than 2x the number of photons for us to see it as twice as bright.

The consequence of this for digital photographs is that if the computer renders the colours in a direct linear relationship to how they are recorded in a RAW file, they will look dull and flat (lacking contrast).

To correct for this, we can adjust the colour intensities so that the computer displays them non-linearly. In Photoshop/Lightroom, the Tone Curve (or “Curves”) tool does this. In darktable there are two modules: the Base Curve and the Tone Curve.

The darktable Base Curve

The base curve tool can be found in darktable’s “basic group” of tools. It is applied to imported RAW photos by default.

darktable base curve module
darktable’s base curve module

The base curve module has a lot of presets, with curves for most major camera manufacturers to recover an image similar to that seen on the camera viewfinder. (The picture above shows the Nikon preset).

You will find that the preset curve for your camera doesn’t always work without some tweaking. One option is to try the presets for other manufacturers. Alternatively, you can alter the curve directly.

How to adjust curves to edit a photo

If you play around with the different base curve presets, you’ll notice that they all share a characteristic ‘S’ shape. It is this shape that makes pictures bright and contrasty.

Characteristic S shape of the curves module for increasing contrast
Characteristic S shape of the curves module for increasing contrast

The horizontal x-axis of the curve represents the brightness of the pixels before the base curve is applied, and the vertical y-axis shows the brightness afterwards.

An S-curve will make the brightest pixels brighter and the darkest pixels darker. The contrast of the mid-range also increases: the steeper the middle part of the S, the more contrast-y the mid-range.

As you can see from this example curve, the brightness of pixels can be altered quite significantly by a curve.

S-shaped curve to increase contrast
S-shaped curve to increase contrast

You can also apply the opposite of the S-curve:

curves2As you might expect, this will decrease the contrast, and flatten the picture. This may be useful if you have a scene that has too much contrast (very bright areas and very deep shadows).

Further reading

Want to get tutorials like this straight to your inbox?

Sign up for the monthly FreeThatPhoto roundup of open source photography news.

Leave a Reply