Skip to content

White balance presets

miroslavfikar edited this page Apr 12, 2023 · 5 revisions

Getting white balance presets

Most (if not all) cameras allow choosing white balance preset (like Sunny, shade, flash etc). Every camera has different parameters that allow changing white balance and exactly that data is used to create white balance presets.

Many cameras offer finetuning of white balance to allow you greater control of it during shooting. darktable too can take advantage of it, so if you'd like please consider providing samples with finetuning.

Prerequisites

darktable has 2 tools to extract white balance data from images: extract_wb.py script and easier extract_wb_from_images.sh shell script.

common

Both scripts require exiftool utility.

extract_wb.py specific

extract_wb is a python script, available only in darktable source package

Preparing images

First things first: the content of images doesn't matter at all for white balance presets extraction. You can even have the cap on 😉 Only make sure you are shooting in RAW.

It should be noted that some interchangable lens cameras (like Sony Alpha series) will adjust the WB coefficients slightly depending on which lens is attached to the camera. Therefore, to get the most generic set of WB presets, it is recommended to make the test shots with no lens attached to the camera (you should of course put a cap on the camera body to pretect your sensor).

There are 2 ways of getting the presets: Non-finetuned and finetuned. We prefer to have finetuned presets as this allows more control in darktable.

Non-finetuned

This is easiest take 1 shot for every white balance preset except for Auto or Custom preset. Make sure there is no white balance finetuning enabled.

Finetuned (properly)

For every white balance preset available in your camera,except for Auto (Custom or others) that allow finetuning you'd need to take shots with finetuning on amber-blue axis. Make sure you don't move finetuning on magenta-green axis. Consult your camera manual beforehand.

Here's the procedure

  1. choose white balance preset
  2. move finetuning maximally towards amber, then take shot.
  3. move 1 step (or if your camera allows - half step) away from amber and towards blue. take shot
  4. repeat moving towards blue and taking shots till you reach blue.
  5. repeat from 1st step of procedure choosing next white balance preset

depending on your camera this may mean anything from 3 to 25 shots per white balance preset.

Finetuned (lazy)

If getting finetuned shots is too much work, but you'd still want to have finetuning available, you can do 3 shots per each white balance preset:

  1. maximum amber
  2. centered (no finetuning)
  3. maximum blue.

darktable will then be able to interpolate. however the interpolated values might not match the ones produced by camera.

Extracting presets

Put all shots in one directory. Then open said directory in terminal and execute chosen script.

This tutorials assumes that darktable tools are in /usr/share/darktable/tools directory.

using user-friendly extract_wb_from_images.sh

execute

$ /usr/share/darktable/tools/extract_wb_from_images.sh *

and send us resulting package via white balance issue

A developer will take care of the data and create presets in darktable

developer-centric extract_wb.py

execute

$ /usr/share/darktable/tools/extract_wb.py *

You can now create new white balance issue including generated data or prefferably - clone darkrable repo, paste data in appropriate place (sorted alphabetically) in data/wb_presets.json, compile darktable using building instructions from Developer's portal, check if presets work and then create a PR with your changes.