photo: Darktable tips and tricks

Well, I can’t stand the idea of paying so much for Adobe Lightroom, so I ended up using DxO for years and years, but now DxO is sort of doing the same thing with annual upgrades, so to go from my current DxO 4 to DxO7 is $226, so this made me wonder if I couldn’t replace all this with open source tools. I tried a few of these but have settled on Darktable mainly because had lens correction built into it. I’ve also tried to use Rawtherapee, but chose Darktable because it was getting Mac updates and Raw Therapee was a bit stalled bit they did an update in November 2022, so I have to try it again. Darktable has local edits with masks was a big advantage and added perspective correction, but the 2022 release added that, so next time I’ll give it a full try. There are other tools like RawPower which is designed by the guy who used to lead the Apple Aperture team I have to try it as its tuned for dealing with Apple ProRAW files.

The Basics: Understanding you are running a pipeline

The main problem is that the interface is pretty different from Lightroom and DxO for that matter, so it takes some time to figure out how it works. The core ideas are hard to figure out from the manual, but there are three big things to understand:

  1. Modes. At the top are the major modes which are light table and darkroom and then Other. Light Table is like Lightroom, it’s a way to import photos into the system (you don’t make a copy), but it has a database of images and writes an XMP file next to your original with all edits. In the other category, the main thing is Map which is like geotag, it is a way to put location into your photos. Things are a little frustrating in that in darkroom module, you can’t delete an image, you have to click on the lighttable module to delete. By the way, the short keys here are that you need to select from the keyboard by using the arrow keys to get to it and type ‘d’ to go to the darkroom and ‘l’ to go to the lighttable.
  2. Modules. Ok, this was a little hard to understand but there is a pipeline of 60 or more modules, so it is like a Unix filter, the output of one module goes into the next. This is the daunting part since it is an open-source project, the order in which you run the modules makes a difference. You can also copy a module so that if you want to have different exposures in different areas you can just duplicate a module.
  3. History. OK, this is a very powerful idea which they don’t really explain enough. They keep talking about history, but it is a terrible name, a better one might be “transformation list”. This is the idea that every image has a list of what modules need to be run to get the “final image”. This is a really powerful idea and it is exactly what is stored in those XMP files.
  4. Styles. The thing is super confusing but basically given so many parameters, you can apply a set of effects with different modules at once. That way you don’t have to go to every photo and do the same thing over and over. That being said I’ve definitely not mastered styles. The main issue is that you can’t actually see what is inside the style, you have to click through all the modules when you apply to see what it is doing and there is no way I can find to edit a style.

With things like Rawtherapee, this isn’t how it works, it is a pile of features that in some ways is easier to get, you don’t have interactions between modules, but it is harder to understand the whole thing and modules get deprecated, but it makes the Darktable manual a series of module explanations

Module navigation and Screen layout

Note that each “module” works the same, there is a little arrow icon on the left which you use to open the options and close them. There is an i with a circle that resets each module to default. And each sub-panel in a module has the same close and expand on the right.

So on the left pane are all things that have to do with files. Then on the right pane are all the things having to do with editing the photos. The whole thing is modal as at the top right are the mode that you are in.

File Structure and Editing

The main concept is that if you feed darktable a folder name, it will find all directories underneath and call them film rolls, so the easiest way to set this up is to have all your photos in a single directory like ~/Pictures/raw

The second thing to understand is that this is all non-destructive editing, you never change the RAW files you have, instead, there is a central database that lists all the changes and there is an XMP file that is matched by filename, so with that, you never have to worry about losing your images. It does mean that to see the final result, it has to run through the modules, but believe me on an M1 Mac it is instantaneous.

Lighttable and File Model

On the left pane are things that deal with the files themselves. So this is where you add to the library and you have a finder. They use different terms to be cute, so a directory full of photos is called a collection. And each folder which has just pictures is called a film roll. But you get the idea. This thing like Adobe Lightroom is designed to be very fast for very large photo libraries that professionals might have. The storage model is it doesn’t copy the the photos into a central database, instead it just stores a pointer to the photos. This means that if you move things around, it will not be able to find things, so just don’t do that.

The things on the left are for sorting and searching so you can rate images, filter with labels and look at the image information. To me, the most useful thing for me is the image information which shows all the EXIF information.

The right pane has things that you can do to the images. The ones I use a lot are selecting images (which I do with keyboard shortcuts) and then you can “remove” them from the app’s view, but what I use a lot is “delete(trash)” which gets rid of the RAW images. I use this a lot because, well curation, it is far easier just to shoot 300 images and then delete 200 than to keep the junk images around.

Selection is tricky remember to move the mouse away

Here are the big selection tips which are pretty confusing:

  1. In the UI there is the concept of selecting a group of images vs selecting a single image. This really threw me off. But basically, if you see a bright border around an image then you have selected that single image. If you see a light grey then you have selected just one. The confusing thing is that you can do the usual Shift-click to select a multiple, but the last one is bright-lit, so you will only operate on that one image.
  2. The right way to do this is a little tricky, if you move the mouse to an open area so it is not on any image, then the white goes away and the light grey is selected. Here is the worst part, the upper display says you have select 20 out of 38 images but if you have the bright white, it really means select only one. With the keyboard, this is hard to do you can use the cursor keys and hit the spacebar to select, but you always get the last selected one in white.
  3. I hit this a lot with export where I would select a bunch and hit export and only the last bright white one is exported. ARgh
  4. When you are looking at the lightroom, one super useful shortcut is x which moves you from the filmstrip of little thumbnails to a full-screen view of the picture and doing it again moves you back, so you can quickly delete what you don’t need.

Key Modules to Start

Now once you have culled the photo, you can hit “d” and go to darkroom. This leads you to a view where on the left pane, you have the history (see below), image information (the tags in the file) and export this single image. With Light Table, you can do multiple, this is duplicated so you can export just one file which is nice.

But the real work is on the right pane which is pretty complicated. Basically there are an array of submenus with different modules listed. I found it most convenient just to start from the left and fill in everything that you need. So going through each module you have first you have the main list which are the common ones to change. Many of these are the highest level and you click on the square icon to go to the actual module:

  1. Local contrast. This you can just turn on and off and hit the square for infrequent adjustment
  2. Filmic RGB. This one I turn on and the key to this one is if the histogram shows that you have “Exposing to the right” which is a long way of saying look at the histogram and see if the colors are up against the right or brightest part. If so, then you can use this to push the exposure down and it looks much nicer
  3. Color balance RGB. This is the way to make things more saturated or bright. I don’t normally use this, I like my photos pretty natural.
  4. Color calibration. I normally leave this off unless there is a special effect. If you do want to use this make sure to turn color balance to D65 or “Camera Reference” so the two don’t collide.
  5. Exposure. I normally leave it off unless it is too dark or light. Normally if you use it just use manual mode and you can try the eyedropper which will try to find an exposure that gives you a uniform look. But in automatic mode for RAW images, it is pretty good if you have images where you want to shift them all to the same exposure level.
  6. Rotate and perspective. Instead of using the slide, click on the box and you can draw the horizontal and vertical line and it will figure it out.
  7. Lens correction. I leave this on, this fixes the distortion in the lens if it is in the database
  8. Denoise. Yes, I turn this on, particularly for high-ISO shots.

The next block shows only “Active Modules” so you can see what is actually running, here’s a typical list:

  1. Output color profile. See below, but going from smallest colors available to largest: the safest is sRGB which works on all browsers, AdobeRGB is next and these are great if you are doing to only push out 8-bit color. But, if you are going to use a format which is wider, then you can go to bigger color spaces with favorites including ProPhotoRGB which I used for years or one of the newer 4K HD spaces like Rec.2020 which come in three flavors, linear, PQ and HLG. The last two map the colors so that you get more colors in the effective visual range of the human eye, but the downstream system has to be able to recognize it. Since I’m mainly dealing with 14-bit RAW input, there is no problem with picking any of these. I usual settle on linear REC.2020 as even with JPEG this works out nicely.
  2. Local contrast. I nearly always turn this on, this basically increases the difference between light and dark (the contrast) for small parts of the image. The effect is usually pretty small, but you see more detail.
  3. Sharpening. This is the old Gaussian filter which makes edges appear sharper. If you turn it up too high it can be very bad, so I normally leave it at the defaults.
  4. Color calibration. I normally leave this off as I let the camera do the talking, unless I don’t like the green color that comes from really blue light. OK, this is where you can change the actual color that you see, if you trust your camera, you shouldn’t need to turn it on, but if there are errors, if you click on the little dropper icon, it will look at the scene and guess. It’s very good at removing color casts and if I like a little yellow, I will set the illuminant to D (daylight) to get a 2144K temperature that is nice and warm.
  5. Crop. This you can use to get rid of junk on the edges. And if you want portrait there is a little circular arrow you can hit. This is one where the reset which is the “i” icon is very useful.
  6. Exposure. Normally I just try to see if I can leave this one alone and let the camera do the work, but I will try automatic mode and play with a lot by looking at the histogram, but typically, i leave it set at 50% percentile is a -4EV and I look at the histogram to make sure I’m not crushing out colors by moving the EV to the right. The Gamut checking icon CMD-G is really useful here, you don’t want it too dark or too light.
  7. Chromatic aberration, lens correction and denoise. I usually turn all these on. With a good lens they have minimal effect. This is using an open source database to figure out what lens you have, so having that EXIF information is critical.
  8. Highlight reconstruction. I normally leave this on, basically the idea. is that if you are overexposed, it will turn it down a little.
  9. White balance. This one I normally leave this as “as-shot” so it is what the camera is guessing white is. But, I sometimes try the camera default and see if there is a little art in playing with colors. For instance, if an orange hue for an indoor scene is warm.

The one after this is the “base modules” and is a circle icon, it is yet another list of things. The most notable difference is adding the rotate and perspective.

After that, we have color-oriented modules. Most of the time I’ve not used color zones or balance RGB and we cover calibration already.

Then there are the lense oriented ones with some specialty ones:

  1. Sharpen. We covered this, but zoom in and see the effect
  2. Astrophoto denoise. For long exposures get rid of noise
  3. Retouch. I’ve not tried this one, but it is to get rid of artifacts
  4. Liquify. Another specialty one I’ve not tried, but it warps parts of the image for special effects
  5. Haze removal. I’ve used this a bunch in landscapes. Makes the blues brighter.
  6. Chromatic aberration, lens correction and, denoise. I make sure these are on.
  7. Hot Pixels. For long exposures if a pixel turns white get rid of it.
  8. Raw chromatic aberrations. Turned off. This is like chromatic aberration but applied early in the process, just use chromatic aberration and lens correction.

The last one on the list I normally don’t use, but they are basically special effects that are more like what Photoshop does. I don’t tend to use process my photos much so only use vignetting

  1. Watermark
  2. Framing. Adding a border around
  3. Vignetting. I actually do use this if I just want a portrait and don’t want to see the background.
  4. Grain. Adds back the noise of analog film grain
  5. Blur. if you didn’t use a shallow depth of field and want to blur the background

All Edits in a History (aka Transformation list)

OK, so you’ve thrown a bunch of photos out, now hit the d key and you are in Darkroom mode here is a tour of what is important the most important being the idea of a History which is all the transformation and what order they are done.

So on the left, you will see numbers from last to first all the things that you have done with that image. A typical sequence is going to be first at 0 take the original, then do a raw black/white point module, then demosaic, then apply an input color profile, etc. All of these operations are done on the right, but it is cool to see everything that is being done and in what order

So they use these funny ideas like “apply a history to a new image” which in English makes no sense. What they mean is that you have a list of things you have done like change exposure or change the color, this is what is in the history, so you can just rerun this. What is most confusing is that there is this concept of “compressing a history”. what this means is if you have a bunch of things you did like change the color back and forth it throws away the ones that get overridden.

This tells you what a style is. A style is just this list of “transformations” with a name. So on the right pane, when you click on the history stack, you can copy all the transformations from one image to another and apply it.

Also, there is a style module where you can name it. By the way, a very undiscoverable feature is that if you have a set of styles, if you leave your mouse on top of one, it will show you a thumbnail of what that style will do to your picture.

The most important idea is that you can bundle up the changes and then apply them. The easy way to do this is to “compress history stack” and then click on the icon on the right in the history module and create one. This is sort of the key to efficiency. It is much better than DxO where there are styles but you can’t preview and see them.

Turning on GPU access

The default system only uses the CPU, but you can use OpenCL to use the GPU on Apple Silicon. I’ve found the thing to be pretty fast CPU only, but what the heck I turned it on.

Adding GPS Coordinates in Map

OK, this is a little hard to find, but if you select a bunch of photos and then click on Other at the top and then Map, you can browse there. I did find that the search for locations doesn’t seem to work at all, it just returns, so I had to browse and scroll a lot to find the location, but then you just

Exporting tricks and color profiles using Rec.2020

To export the files is pretty simple, there is an export in the right pane in Light Table and on the left pane in Darkroom, but you set the output profile if you want to override what is in image and then pick the types. The tricky thing is set the right file and also the color profile.

One of the things that is pretty hard to understand is color profiles. Our camera uses AdobeRGB as its core profile so it is not an HDR system, so there are three different ideas, the first is the input color profile and you can set this for what is in the image file. Fortunately, most modern cameras tell you what the format is for most cameras it is sRGB or the broader AdobeRGB. One quick note here is that this is the list of all possible colors. There second is how many bits you have to represent things. The default for JPEG is 8-bit per color. The problem is that “sRGB < AdobeRGB < Rec.2020” so if you have a camera without 256 color representation for a large color space like Rec.2020 then you can get banding and other horrible effects.

Not JPEG-2000 12-bit, JPEG-XL 16-bit, or AVIF 12-bit yet

One of the output options is 8-bit JPEG, then there is 12-bit JPEG-2000 and something called 16-bit JPEG-XL. Of these JPEG-XL was done in 2020 and competes with HEIC, which uses the HEVC h.264 encoder, and AVIF. These would be great formats as we really want a nice 14-bit at least color. Turns out that as long as you set the color profile to linear Rec2020, you get a very nice rendition in JPEG-2000 It is pretty cool that Preview and Apple Photos support all these. The long-term future for Apple is HEIC (AVIF is the same container but uses the AV1 codec instead of the HEVC or H.265 codec).

However, the format I wanted to use is AVIF in 12-bit mode because it has more compression but, the JPEG-XL and AVIF exporter strangely the linear Rec.2020 doesn’t work. Using PQ Rec.2020 for AVIF, which is the normal format for movies works great on export and they both look great in Preview and in Finder Preview.

For grins, if you take the same image, the file sizes are 126MB for 16-bit OpenEXR (see below), 38MB in AVIF 12-bit, 22MB in Jpeg-2000 16-bit and 13MB in JPEG-XL. However, JPEG XL isn’t supported in the Mac so got to watch out for that. I’m not quite sure why AVIF is so fat compared with JPEG formats. I would have thought it would be more efficient.

And they don’t do HEIF export, only HEIF import.

Dealing with missing EXIF tags is hard

Even those we have “darktable > export > preferences > metatags” set to all EXIF data, we found that this does not work for JPEG-2000, JPEG-XL in that it doesn’t export the maker data so you don’t get any of the camera shooting information. And there don’t appear to be any tags at all in AVIF file because there are concerns about IP violations if the open-source EXIV opens and reads the file (which is pretty sad) but they appear to have done it in 2021, but it doesn’t seem to work in the tools I had.

Apple Photos imports everything but only recognizes the OpenEXR format as an HDR format so use that and you will lose all. For the SDR formats, only JPEG retains the EXIF information on export which is a big bummer for long-term use. You can use jexiftoolgui to try to copy these graphically, but first of all, jPEG-2000 isn’t supported and the so-called MakerNotes which tells you the image exposure and other settings isn’t copied with the underlying EXIF tools so this is kind of a deal breaker for all these format. Also jexittoolgui is now discontinued in terms of support so relying on it doesn’t seem so smart. So you are back to the exiftool command line. I tried some other mac EXIF tools but they all cost money. You end up with some difficult syntax like, “exiftool -tagsfromfile src.jpg -exif:lla dst.jp2” for instance

Apple Photos use JPEGs for a minimum of fuss

The net is that if you export as a JPEG then it handles all the profiles well from AdobeRGB to all flavors Linear, HLG and PQ of Rec.2020. And the converse is true, if you set any of the formats to AdobeRGB it looks fine with JPEG, JPEG-2000, JPEG-XL or AVIF.

This isn’t true for JPEG-2000, where the AdobeRGB looks washed out and the HLG and PQ Rec.2020 formats look washed out. I’m guessing the profile isn’t correctly written. And the Linear Rec.2020 looks very contrasty and dark. Net, net you can’t use JPEG-2000 with anything other than AdobeRGB.

For JPEG-XL, Adobe and Linear Rec.2020 look great, but the PQ and HLG look washed out, I’m guessing this has to do with profile problems.

For AVIF, all the profiles from Adobe to all three Rec.2020 formats rendered correctly in SDR, but I think the linear or HLG is slightly preferred, it is more saturated while the PQ is less saturated and the HLG looks identical to linear.

Based on all of this, this would make AVIF the winner in terms of handling everything properly. Second place goes to JPEG-XL and linear Rec.2020. As if this wasn’t bad enough, the AVIF files do import into PHotos but somehow they eventually a rendered incorrectly. Not sure why. So the most stable format looks like JPEG-XL is a winner here with 16-bit encoding and only slightly larger file size than 12-bit AVIF. AVIF seems like a more modern format being based on AV-1, but JPEG-XL was done around the same time. Both aren’t popular formats, but if you want to get 16-bit out to everyone this is the way to do it.

If you want more bit depth use 16-bit JPEG-XL and retag

But one big problem is that with darktable, you lose all your tags exporting to AVIF, JPEG-2000 and JPEG-XL. So you have to go in and fix every photo and you are still losing all the manufacturers shooting data. This should be OK if you keep your RAWs and XMP files so you can always recover it, but it is a pain to put locations back on all your photos manually and all the date and times as well.

Alternatively you can use a third party tool like geotag which is more automatic, but it only works with AVIF and will not retag JPEG-2000 or JPEG-XL.

Faux HDR images in OpenEXR 32-bit Linear Rec.2020

But, we are feeding the system a 14-bit RAW that has 14 bits of color in a typical Sony A7R Mark III so even though it is SDR, there are a lot of pixels. Internally, the representation is linear Rec.2020 which means that you can expand the image way beyond the initial environment and make it in effect an HDR image. It has 14EVs.

The big tricks are:

  1. The default working space is linear Rec.2020 so its no surprise this is the required export format. I thought incorrectly that it would convert to HLG or PQ as Final Cut Pro but this doesn’t seem to work.
  2. Disable any module that does dynamic range compression. If you are using scene-referred workflow, then you disable Filmic which basically pushes all the bright colors backward if you are doing Expose to the Right (EttR). The short answer is that ETTR overexposed the images so you don’t lose all the shadows
  3. Now you do the things that don’t affect color like lens correction, white balance, highlight reconstruction, denoising, etc.
  4. You can’t actually see any HDR from Darktable itself, it always projects in sRGB even on an HDR display like the Mac. So instead you have to have some enable the ISO 12646 color assessment which is the little lightbulb at the bottom right of the image or do a CMD-B.
  5. Now you have to over-expose the system, so turn on the gamut clipping which is CMD-G and is the triangle with the i in it. And going to +5EV is not unusual which makes sense, although I find +2.5EV what I normally use for 16-bit EXR (see below), so you might want a special style for that. But I found that for my exposed it’s better to use the O so you can underexposed and right-click and set the soft profile and histogram to linear Rec.2020 and then turquoise means under-exposed by more than -12EV (the default) and overexposed is still wrong since you can go over 100%
  6. Then export it using the OpenEXR format in 32-bit format with linear. I found that the 16-bit has less dynamic range but is much smaller of course, but the whole point is lots of dynamic range. Also, there are a host of different compression formats with PIX being the default which is faster to write but slower to read than PIZ and both are about 2.4x compression, so if you mainly read files, then Zip is the answer. But you are talking about 300MB per image in HDR so there’s quite a penalty at 32-bit float remember there are only 14 bits or so of real image data here, so i think 16-bit float is probably fine and is about 120MB per image compared with the RAW files which are also in the 80MB range.
  7. You try to use a command line utility with a brew install openexr and you should have a nice image but this seems like it is just the command line and you need an application for it. Other folks say that the latest Ventura versions of Apple Photos and Preview handle HDR with EXR format and this does seem to work if you set it to linear Rec.2020 but is completely wrong with the PQ (picture quality Rec.2020). So the magic is OpenEXR in Linear Rec.2020 format. As far as display quality goes, while we have an LG B9 display that goes to 400 nits, the best way to view this is on the MacBook Pro display itself or an Apple iPhone with the OLED panel.
  8. If you are doing this you probably want to “duplicate” an image in the lighttable to get both SDR and HDR images as HDR images look pretty bad. So I normally output a conventional crappy 8-bit JPEG, a 12-bit AVIF, and a 32-bit EXR with 32-bit floating point. Note that the HEIC format is only 8-bits at least on a Preview export, the only format that seems to support 16-bits is OpenEXR. I’m not sure why the 16-bit HEIF is greyed out as the iPhone camera can record 10-bit color and of course, the Sony has 14-bits worth.

Net, net operate in Linear Rec.2020 space and then export as openEXR 32-bit format in Linear Rec.2020 and you should be able to view these properly in Apple Photos. The only issue is the lack of any meta-tags, but in reality you can add the location information manual in Apple Photos or Geotag.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect