the anatomy of a processing module
The basic element of image processing in darktable is the processing module. In order to process a raw image a number of such modules act on the input image in sequence, each performing a different operation on the image data. For those familiar with Adobe Photoshop, the concept of a processing module in darktable is analagous to that of an adjustment layer in that both make an incremental adjustment to the image, building on top of the adjustments that came before.
darktable also provides utility modules, however these are not directly involved in image processing, and instead provide a GUI that allows you to manage your images, tag them, export them and so on.
Every processing module executes independently in a similar manner:
Receive the module input from the last executed module and perform an operation on it to produce the processed output. This operation is different for every processing module.
Combine the module input and processed output using a blending operator to produce the blended output. If no blending is performed, the output of this step is the same as the processed output.
Generate a mask, which defines an opacity for each pixel in the image. The opacity is later used to control how strongly the module’s operation is applied to each part of the image.
You may define your own mask by drawing shapes over the image or by using pixel properties from the module input or processed output (see masks for details). This mask may be further modified with a global opacity setting, which affects every pixel equally.
If no drawn/parametric mask is used, the output of this step is a mask where every pixel has the same opacity (governed by the global opacity setting). If no opacity is defined (no blending is performed) a global opacity of 1.0 (or 100%) is assumed.
Combine the module input and blended output pixel-by-pixel using the mask as a mixing operator, to produce the final output. Where the mask opacity is 100%, the final output is the blended output for that pixel. Where the mask opacity is 0 the final output is the module input for that pixel. An intermediate opacity combines the blended output and module input proportionally. The final output is passed to the next module for further processing.
Steps 2 and 3 are optional and not supported by all modules. For example, the demosaic module must be applied to the entire raw file in order to produce a legible image so it does not make sense to mask or blend its output.
Each of the above steps is defined in more detail in subsequent sections.