|
|
Log in / Subscribe / Register

Raw photo development with darktable

By Jonathan Corbet
January 21, 2022
One of your editor's long-time hobbies is photography; it is an activity that can be rewarding even with the lack of any particular talent — a useful attribute. Photography has changed greatly over the years; as a result, those hard-earned darkroom skills are of little use, and photo processing has become yet another software problem. This is a field that supports a lot of proprietary software, but there is also no shortage of free software available. The time has come to combine work and pleasure and catch up with the state of free software for photography, starting with the darktable raw photo editor.

Raw images

Digital cameras normally produce their photographs in a convenient and compressed image format, most often JPEG. But, just as our brains perform a great deal of invisible processing to make our eyes work as well as they do, digital cameras do a lot of work between the sensor and the storage device. The data recorded by the sensor does not make for a particularly satisfying image until it has been through exposure compensation, white-balance adjustment, noise removal, sharpness adjustment, and even, with some devices, advanced manipulation like high-dynamic-range processing. The results from today's cameras can be amazingly good, but they invariably encapsulate a set of processing decisions and loses information from the original image.

Professional photographers — and hobbyists with an inflated sense of the quality of their snapshots — often choose to do that post-processing themselves. For such people, cameras can be convinced to write the raw data from the sensor (or something close to it) directly to a file in a format that is [Flatirons] normally referred to as "raw" (or "RAW" even though it is not an acronym). Photographers can work with raw files to take full advantage of all of the data collected by the sensor and apply their own preferences — if they can get at that data. Naturally, every camera produces raw data in its own special, proprietary format. Fortunately, the free-software community has proved skilled at understanding these formats and writing decoders for them, so there is support for raw images from most available cameras.

Taking photographs in raw format implies a commitment to put some time into "developing" them into a more useful form; that is what a raw image editor is for. There are several of these editors available, including darktable, which is where your editor chose to start. In the name of "research", an afternoon was taken off work to wander in the local parks in search of a suitable raw image to process with darktable; the result is shown on the right. This image is a JPEG thumbnail created by the camera and stored with the raw image, extracted with dcraw. It is not a great work of art by any means, but it is useful to experiment with: there is a lot of contrast, and the rock formation (known as the "Second Flatiron") is somewhat lost in the haze that was present that day. This picture might just benefit from the sort of manipulation a raw editor can perform.

Running darktable

Launching darktable for the first time is a bit of an intimidating experience. It presents two columns of controls, most of which are hidden behind at least one layer of tabs; there are literally hundreds of things that one can tweak. Fortunately, the project has put some time into its documentation, which includes a set of steps to follow to learn how to make basic edits.

[The lighttable] The first step is to import images into the application. Darktable can maintain its own directory full of images, but it is also happy to work with image files stored anywhere in the filesystem. There is a module available to import raw images directly from a USB-connected camera for those who prefer to work that way. In all cases, the end result is the "lighttable" screen, where thumbnails of all of the imported images are displayed.

The next step in the suggested workflow is to assign star ratings to each image in an iterative process, eventually eliminating all except for the best ones. Simply hitting "2", for example, marks the image under the cursor as a two-star photo. Images below a certain number of stars can be hidden (or deleted outright), allowing the photographer to focus their effort on the best prospects. Users should remember that this is not a ride-sharing app, and so the full range of star ratings can be used without ill effect.

Then it is time to pick an image and go into the "darkroom" to process it into its final form. Darktable uses a pipeline model (the "pixelpipe") for this processing; there is a long list of modules that can perform specific tasks in this pipeline. These modules are arranged in a series, with each module operating on the output of the one that came before. As an image is passed through this pipeline, it is transformed from the raw format into (hopefully) what the photographer wants it to be. While there is a logical order in which to use many of the modules, darktable allows them to be ordered arbitrarily, and multiple instances of the same module can appear in different places in the pipeline.

As one studies those modules it becomes apparent that darktable is currently going through a major transition in how the pixelpipe is expected to work. Prior to the 3.0.0 release in at the end of 2019, darktable supported a processing mode called "display-referred"; thereafter, the "scene-based" workflow is used instead. The difference comes down to when the color mapping is performed on the raw image.

The dynamic range of the data in a raw file is greater than can be displayed on the screen or represented in a JPEG file; that is part of why photographers use the raw format. At some point, though, the dynamic range must be reduced so that the image can actually be displayed. The display-referred workflow performs that processing near the beginning of the pipeline, with all subsequent modules working in the display color space. In the scene-based mode, the color mapping is deferred until the end, after other processing has been done.

The advantage of the scene-based mode is that it retains the full dynamic range of the raw image for as long as possible, leading to better results at each step in the pipeline. The change makes sense, but even in the current darktable 3.8.0 release it is clearly incomplete. Many of the provided processing modules only work in one mode or the other, but they are all jumbled together in the interface (and the documentation) so the user must sort them out. If scene-based is the way to go, darktable would do well to simply hide all support for display-referred work by default.

Processing the image

The darkroom view is made up of three columns, with the subject image taking up the middle column. On the right, below the color histogram, is the set of processing modules, which can be displayed in a number of ways; clicking on any given module will open a pane with, potentially, several tabs of adjustments to tweak. The left column contains another set of modules, such as the color picker and image exporter, that don't operate directly on the image.

The first step with a new image is to set the overall exposure. The exposure module can be used to compensate for a photograph that was under- or overexposed in general. Indeed, the darktable documentation [The darkroom] suggests slightly overexposing photographs ("exposing to the right") and correcting the exposure in postprocessing.

Adjusting the exposure is a simple matter of moving a slider, but one quickly encounters the complexity of the darktable interface — there are five different ways to adjust a slider. Left-clicking on the range will set the slider cursor to the indicated spot. One can use the mouse scroll wheel to make incremental adjustments; the keyboard arrow keys work in the same way. A right click on the slider, instead, pops up a two-dimensional control that can be used for extreme fine-tuning. Finally, double-clicking on a slider resets it to the default value.

The next step goes to the far end of the pipeline and the filmic rgb module, which performs the color mapping for the display. Here one can set the white and black points for the image, picking the portion of the dynamic range that will be used to create the final result. Many other adjustments can be done here, including contrast tweaking, but the intent isn't to get a final image yet.

Moving back to the earlier parts of the processing pipeline, the color calibration module can be used to correct the white balance of the image if the value chosen by the camera (and stored in the raw file) is incorrect. Setting the white balance can be as simple as clicking on a part of the image that should actually be white; as it happens, pictures with snow in them make this task easy. This module can perform much more sophisticated changes, though. For example, like almost all processing modules, it can use a mask to only operate on part of the image; if one has an image needing a different white balance in different regions, the color-calibration module can be employed twice, with masks, to get the job done. Changes far beyond white balance are possible as well.

Your editor played with these modules for a while, and also brought in the haze removal module to clean up the background, with reasonably good effect. At this point, though, something jumped out: the exposure modifications did a good job of bringing out the detail in the image, but at the cost of severely overexposing the sky, turning the Colorado blue sky white. Going back to the exposure module and playing for a while with parametric masks rectified this problem, in a crude manner at least.

A final step was to use the watermark module to add a tasteful LWN logo to the image. After that, one goes into the export module, which can be used to render the final image to disk. All of darktable's editing is non-destructive; the relevant data is kept in a "sidecar" file next to the pristine raw [Final image] image. The export module will run the pipeline, then convert the result to the desired image format. Naturally, there is a wide range of options controlling just how the image should be exported. There is also a separate print module for getting images to paper.

After all that work, your editor ended up with the image shown to the right. This result, your editor's first with darktable, bears more resemblance to a preschooler's finger painting than actual art, of course. The color of the rock still is not right, and there are numerous artifacts along the skyline, for example. But it is an illustration of the sorts of things that can be done by even a naive darktable user.

There is, of course, a lot more there for the advanced user. Various modules can perform highly specialized processing in ways that, it seems, that only a user with a PhD in color management can understand. There is a whole mechanism for remembering the configuration of collections of modules that will clearly be useful for photographers who end up doing the same sort of processing repeatedly. If that's not enough, the whole thing can be scripted in the Lua language.

Community and conclusion

Darktable is licensed under version 3 of the GNU General Public License. The program is written mostly in C, with a handful of C++ files tossed in for good measure; it uses the GTK library for the user interface. The most recent release is 3.8.0, which came out in late December; it added a new keyboard shortcut system, a new diffuse/sharpen module, reworked perspective correction, a new demosaic algorithm, support for the Canon CR3 raw format, and more. The project produced one other major release (3.6.0) in 2021 as well, and seems to keep two-release-per-year cadence.

In the time since the 3.4.0 release (just over one year), the project has merged 4,071 changesets from 125 developers, so it does appear to have a reasonably wide contributor base. Of those developers, Pascal Obry was responsible for nearly 22% of those changesets, with Ralf Brown contributing 11%; the top five developers contributed just over half of the changes. The core of the project's community is thus small, as is often the case, but it is definitely not a one-person show.

The project is centered around GitHub, with most of its communication happening there. It does have a development mailing list but makes relatively little use of it; indeed, the project's contact page suggests that "the mailing lists should be your last resort". Discussion on the project's posted issues is active. All told, darktable looks like an active and healthy project, one that a photographer need not worry about depending on.

Darktable itself is a bit of an intimidating program, but it's not clear that it could be any other way. It is a power tool for photographers wanting absolute control over every aspect of their images. Potential users will need to invest a fair amount of time before they can expect to be proficient with it. For many casual photographers, the complexity of darktable will be a firm reminder of how much easier it is to just let the camera do the image-processing work. For those who are willing to put in the time, instead, darktable may well be the tool that puts them firmly in control of their art.


to post comments

Raw photo development with darktable

Posted Jan 21, 2022 20:54 UTC (Fri) by zaitseff (subscriber, #851) [Link] (3 responses)

Thank you: a well-written and informative article! I'm looking forward to a comparison with other free software, including RawTherapee, digiKam and plain old Gimp with dcraw—to help lowly amateurs like me decide on a workflow that we could use under Linux.

Raw photo development with darktable

Posted Jan 22, 2022 4:11 UTC (Sat) by kenmoffat (guest, #4807) [Link] (2 responses)

A good article, it almost persuades me to have another try with darktable (I last tried a bit over 4 years ago, in the days of gimp-2.9, and installed it but failed to create a gimp plugin, so gave up).

The documentation updates sound helpful.

So why am I only *almost* persuaded to give it another try ? Easy - lack of time (and too much of that is spent on updating other packages, either for fixes (e.g. this weeks' rust vulnerability fix - need to find out if everything still builds) or for new shinier versions which may or may not be useful), and my backlog of images which turn out to be less good than I had hoped from glancing at the jpegs. I still think that raw is the only way to go, so I currently use ufraw or nufraw with gimp-2.10. For what I'm interested in (often, trains and photos from trains), recovering shadow detail is typically more important than highlights - boosting the exposure after the shot, when a compact camera is already on iso400 because the light was poor, is often a cause for pain. But if I'd been using my SLR I'd have missed many of the shots because I had the wrong lens on it and didn't know what was coming up.

The idea of 'rating' my images as a first step seems a waste of my time - I've already uploaded them to a PC and produced smaller screen-size jpegs to review which might be worth processing.

I did try RawTherapee at that time, but I found it really hard to use (what I usually do is take a "base" image i.e. at what looks like a correct exposure, which may vary from the camera's auto exposure, and then adjust the same image ± a certain amount (often a stop or more) then merge the three, usually add local contrast enhancement ( from g'mic) because of the softness after the merge, maybe add some tome-mapping). Will be interested in any articles on RT and other packages. And yes, "real" photographers are probably horrified at what I do.

Raw photo development with darktable

Posted Jan 22, 2022 21:47 UTC (Sat) by rgmoore (✭ supporter ✭, #75) [Link] (1 responses)

The idea of 'rating' my images as a first step seems a waste of my time - I've already uploaded them to a PC and produced smaller screen-size jpegs to review which might be worth processing.

I think the idea, and probably the problem for you, is that darktable is built with the assumption that it will be the only tool used in the whole workflow. It's designed to start with a big collection of raw files that haven't been looked at before and walk you all the way through to a smaller number of finished pictures. That's great for people who either haven't built their own workflow or already want to use a workflow similar to what darktable offers, but it's much less useful for people who already have a solution for part of the process and only want a raw converter.

Image rating

Posted Jan 22, 2022 21:59 UTC (Sat) by corbet (editor, #1) [Link]

The rating of images is, of course, entirely optional; darktable supports that but doesn't require it. If it's not useful, don't do it.

Raw photo development with darktable

Posted Jan 21, 2022 22:51 UTC (Fri) by hjb (subscriber, #25523) [Link]

I checked out Darktable in 2020 and found it a little too complicated. It also didn't seem to fit my workflow. After a weekend of experimentation I decided to settle on Digikam which I used to organize all my photos anyway. I think the image editor can do anything darktable can. And all editing functions are available in the batch processing module too. I use the raw format exclusively since then.

Raw photo development with darktable

Posted Jan 22, 2022 20:46 UTC (Sat) by karkhaz (subscriber, #99844) [Link]

> All of darktable's editing is non-destructive; the relevant data is kept in a "sidecar" file next to the pristine raw image

This is particularly useful in conjunction with git-annex, it allows you to maintain your photo library as a git repository. Darktable itself doesn't impose any directory structure on the files. You can annex the raw files immediately (and the TIFF or JPEG version once you export it), and the sidecar file can be committed to the repository as normal. This fits well with the fact that annexed files are read-only, but the sidecar file gets written whenever you tweak the raw file later. That really helps given how large raw files are, you can keep your raw files on cheap spinny storage until you want to edit them, then just 'git annex get' them onto your workstation to edit and export---and then just keep the exports on your laptop/workstation.

RawTherapee?

Posted Jan 23, 2022 9:35 UTC (Sun) by Herve5 (guest, #115399) [Link]

I am indeed a DarkTable user, mostly because years ago, I found its denoise module more adapted to my camera than RawTherapee's.
But this was so long ago, and both have evolved so much, that RawTherapee's much cleaner interface is still in my mind for a new comparison.

Other significant features for both DT and RT are lens autocorrection support for the raw files, support for printer .icc profiles (so that the colors in your print are the same as on your screen, as long as you profiled both) and their handling of more than 8-bits nuances in the raw files. Also, for people taking pics of museum paintings, both have very efficient perspective correction tools (so that you get the geometrically perfect framing afterwards).
Few other apps feature both of this...

Good article and a reminder...

Posted Jan 23, 2022 20:21 UTC (Sun) by Schroeder (subscriber, #128168) [Link]

... for me to try darktable again.

Excellent choice of camera, by the way :-)

Until now, Silkypix Pro (for general colours and tonality and workflow) and DxO PhotoLab (for best lens corrections and unmatched noise reduction) are my standard tools for raw development, and they unfortunately don't even run on Wine.

Raw photo development with darktable

Posted Feb 11, 2022 2:55 UTC (Fri) by bob_billson (guest, #156805) [Link]

There are number of very helpful videos on YouTube for those new to Darktable. The series by Bruce Williams is quite well done. Each video goes into detail about the different modules and how to use them. When a new version of Darktable is released, Bruce does a video highlighting the changes.


Copyright © 2022, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds