Let’s build our own basecurves

In this episode I work through each of the steps needed to build a custom basecurve. I also share some code I use to build a separate base curve for each camera body and ISO I use. In the end I show how to set up Darktable to automatically apply the appropriate basecurve to your RAW files.

Another in our faster format, but packed with information. It builds on knowledge from previous videos, running full-tilt through tools and methods to achieve the edit. For fuller explanations, return to the Home Page and scroll down to Topics Discussed or Modules Used on the right-hand bar. Click on any of these, and we assemble a complete playlist of every instance from a knowledge base of our first 27 videos for quick review right here on the site.

Build dt-curve-tool

cp .config/darktable/data.db .config/darktable/data.db.bak
git clone git://
cd darktable/tools/basecurve
mkdir build
cd build
sudo cmake --build . -- install

sample.jpg for creating basecurve

My script to build basecurves (make sure Darktable isn’t running when you run this)

rm iso_model_* basecurve.dat dt-curve-tool.bin tonecurve.dat
ls |grep -i jpg |head -n1 |cut -d'.' -f1 |read file
ls "$file".* |grep -iv jpg |grep -iv xmp |head -n1 |cut -d'.' -f2 |read ext
ls *.$ext |while read file; do
  exiftool "$file" |grep -i iso |head -n1 |awk -F': ' '{print $2}' |read iso
  exiftool "$file" |grep -i model |head -n1 |awk -F': ' '{print $2}' |read model
  echo $file $iso $model >>iso_model_db
cat iso_model_db |cut -d' ' -f2- |sort |uniq >iso_model_combinations
cat iso_model_combinations |while read combo; do
  echo $combo |cut -d' ' -f1 |read iso
  echo $combo |cut -d' ' -f2- |read model
  grep " $combo" iso_model_db |cut -d' ' -f1 |while read file; do
    dt-curve-tool-helper "$file"
  dt-curve-tool -z -e $last -n6 |sed -e "s/$model/$model ($iso)/g" >
  sh ./
  rm basecurve.dat dt-curve-tool.bin tonecurve.dat

2 thoughts on “Basecurves

  1. Hi Harry,

    I haven’t had the time to do this yet but here are some suggestions 🙂

    exiftool “$file” |grep -i iso |head -n1 |awk -F’: ‘ ‘{print $2}’

    This calls 4 tools where you just need two of them. awk can do what 2 tools do:

    exiftool “$file” | awk ‘/ISO/ { print $3; exit }’

    but you can tell exiftool to just get the ISO with:

    exiftool $file -b -ISO

  2. Pingback: Weekly Edit 32: Basecurves – darktable FR

Leave a Reply

Your email address will not be published.