RAW development with Vulkan darktable

Tutorial – Vulkan darktable

Article from Issue 259/2022

The RAW converter Vulkan darktable outpaces its competitors with a modern node-graph-based architecture and massive use of the GPU.

Open-source photographers have access to a massive selection of RAW developers, the two best-known and most mature representatives of this category being darktable [1] and RawTherapee [2]. Both are aimed at demanding amateur users and professional photographers and have an enormous range of functions.

Some time ago a RawTherapee fork named ART [3] saw the light of day. ART tries to make it easier for beginners and technically less-experienced users to get started. In addition, a new version of LightZone [4] was released a few months ago, after a gap of several years. PhotoFlow [5] and Filmulator [6] are also two interesting new programs.

This group has recently been joined by a completely new program: Johannes Hanika, the founder of the darktable project, is now working on a RAW converter, the biggest highlight of which is its processing speed. Because the tool uses the Vulkan programming interface [7], which was previously mainly used in computer games, he has dubbed the software Vulkan darktable, or vkdt for short. (See the "Interview with Johannes Hanika" box.)

Interview with Johannes Hanika

Linux Magazine (LM): Why and for whom are you developing vkdt?

Johannes Hanika (JH): Why? Probably because I can. I don't think the old pipeline is sustainable anymore. You can't focus on everything as a developer working on your own. In the case of darktable, [the focus] was certainly more on the interface, the feature set, and the workflow – not at all with a view to a pipeline architecture. It's hard to change that now. And for whom? The same answer as for the original darktable. First of all, for myself, to avoid some other software getting on my nerves. But I'm also happy to share with anyone who wants to use vkdt, as well, or [who] can even contribute something. The darktable community has always been very friendly – and put a lot of ideas and work into the project and made it massive fun for me.

LM: When you started developing darktable, didn't you secretly aim to make a better Lightroom?

JH: One important aspect was that all the commercial stuff never ran on Linux. Even RawTherapee wasn't open source under the GPL back then, and it just wouldn't set up on my system. I never used Lightroom, but saw a few screenshots, and I thought the concept of a workflow specifically for photographers was a good idea. So, I certainly wasn't hell bent on writing something better but instead wanted to help people get along in the computer world without Microsoft and Adobe.

LM: What other features are you planning for vkdt?

JH: Some examples: I'm currently working with David TschumperlÈ (G'MIC) on porting his noise reduction software to the GPU. His code is based on a neural network and is therefore very computationally intensive. These things are becoming realistic in real time if you have fast underpinnings.

LM: Where do you see vkdt five years from now?

JH: I don't plan that far ahead. But I hope by then that GPUs on a par with the 3080 Ti will be very widespread and that the matching programming technique will be mainstream. Then software like vkdt can be delivered without any worries. In darktable there is this strange system with OpenCL, that you don't even dare to link at all, because it means that many users can't install GPU drivers.

LPM: Would you still like to have co-developers for vkdt? If so, maybe not too many, right, because that would make the code too confusing?

JH: You're right about the developers. The darktable code has not necessarily improved for having many developers. Sure, the community has had fun adding new features all the time. But maintaining this kind of code is a pain. If vkdt develops into a larger community project, I would actually be inclined to apply slightly stricter standards for contributions.

LM: You have three small children and a university career – where do you even find the time and energy for vkdt?

JH: Three kids yes, a career maybe not: I'm not aiming for a management position and don't earn a lot of money. Besides, I also need framework code for GPU applications at work, so there are synergy effects. Most people who finish their computer science studies with a doctorate probably have jobs with higher salaries and greater influence. But, of course, we are in teaching, and I also supervise PhD and MSc/BSc students.

LM: Then let's hope you at least continue to enjoy your work and make rapid progress with vkdt. Thank you very much for the friendly talk!

After almost three years of development, the software is now relatively mature. Although vkdt can't quite keep up with its big brother darktable or RawTherapee in terms of the feature set, it's well worth a peek for inquisitive users.

Sucks Less

On the vkdt GitHub page [8], Hanika refers to his program as a "darktable which sucks less,"an allusion to the suckless.org project, which focuses on minimalist software. Some of the better-known suckless.org applications include the dwm tiling window manager, the dmenu program menu, and the keyboard-driven surf web browser. The developers of these applications consider most software to be too complex, too bloated, and overloaded with too many features. In their opinion, a computer program should be limited to the bare essentials, not only in terms of the feature set, but specifically in the amount of code. For example, suckless.org set itself a fairly ambitious limit of 2,000 lines of code for the dwm window manager.

The project's website [9] characterizes vkdt as "an experimental image processing graph," which implies that it is not a traditional layer-based photo editing program like Photoshop but a node-based software like Nuke [10], which is used in video and film post-production for compositing and special effects. The operating principle of this kind of program is based on nodes, which are arranged in a node graph. A node stands for nothing other than an editing step (i.e., an effect such as exposure or color correction). The special feature in vkdt is that each node can have several inputs and outputs. This means, for example, that you can merge multiple images and then process the results as a single image.

If you visualize the complex editing of a photo with vkdt, you get an acyclic directed graph that resembles a subway map more often than not. Thus far, only video editing programs have consistently implemented this principle, but tools such as Lightroom were already closer to node-based editing than to layer-based editing. The adjustment layers feature in Photoshop is also a move in this direction. It should be noted at this point that some users have been using node-based software such as Nuke or Natron [11] for editing photos for quite some time.

No Experiments

Don't be confused by the word "experimental" in the vkdt description. Vkdt is already quite suitable for practical work. The word instead expresses that the program makes use of technologies that have not yet been used for photo editing software in this way.

Vkdt also resembles video editing software in terms of processing speed. According to Johannes Hanika, vkdt computes about 20 times faster than traditional RAW converters, although it also processes 20 times more data. This is only possible because it uses the Vulkan framework to run all the computations on the graphics card. GPUs have many more cores than CPUs, so they can perform many calculations simultaneously.

This mainly benefits graphics applications and computer games, which calculate many pixels synchronously in this way. However, most photo editors and RAW developers so far have mainly – many even exclusively – used the CPU. Before vkdt, darktable was the RAW converter that most consistently put GPU acceleration into practice (using the older OpenCL programming interface). Having said this, even darktable still uses the CPU for many tasks.


However, vkdt's speed is not an end unto itself. Traditional RAW developers only ever compute the area of the photo currently on view in the preview window before the final export. If you move the view, depending on your computer's processing power, it can take some time until you get to see the preview. If you view the image in the full-screen view, the program usually only works with a low-resources version of the photo in order to save computing power and thus time.

For some effects, however, the software cannot calculate a correct preview in this way because this always requires the entire, or full-resources, image as a starting point. Creating a preview that is more or less correct is therefore only possible with massive programming overhead. The preview does not precisely match the final exported image, especially if viewed at different zoom levels or if the view is shifted. This problem is completely eliminated with vkdt because the application always computes the entire image at full resolution and keeps it in the graphics card's memory. If you view a photo in vkdt at 100 percent scale and move the display area, you don't have to wait for the program to compute a preview.

One of the features not yet offered by other RAW developers is support for 10-bit output. Apart from vkdt, only Photoshop and Krita can do this. This means that appropriately designed screens display, say, color gradients in a precise way and without streaking. And all editing modules consistently work in the linear RGB color space, per ITU-R recommendation BT.2020 [12](Rec. 2020 or BT.2020), which defines various aspects of ultra high-definition TV (UHDTV) such as screen resolution (4K/8K), frame rate (24fps/120fps), and color depth (10/12-bit), and RGB color space. This means that the original image data is retained for longer and the modules work more efficiently, especially when reconstructing overexposed or underexposed image areas. In addition, there is no need for constant reconversion between color spaces, which prevents information loss.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Darktable 1.2

    Darktable shines as the most powerful free RAW converter, with impressive new features in the current version 1.2.

  • Perfect Balance

    The current RawTherapee version finally adds selective image editing, among other long-desired features, to help it compete with king of the hill, darktable.

  • ART – Another RawTherapee

    RAW converters are the first tool to use in editing photos, and new solutions and programs have the potential to make users' lives easier. How does ART stack up?

  • Darktable 1.6

    Hardly anything affects the quality of photos more than play of light and shadow, or the brilliance of colors. Darktable fixes incorrect exposure, conceals unfavorable lighting conditions, and ensures harmonious colors.

  • Tutorial – Krita

    Not many people are aware that Krita, the popular open source painting program, is also great for editing photos.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More