Applying WB to jpg/tiff in darktable and RawTherapee

So I did some messing around in rawproc with this, because I built it with such experiments in mind. What I came to is, you can correct white balance just about anywhere in the processing chain, but the “as-shot” white balance multipliers need to be applied before the image is scaled to display white, while there’s still room for the multiplication.

I opened my test raw, applied the default raw tools, and deleted the white balance operator:


A couple of explanations are in order:

  • Yes this image is green, please don’t talk about that. :smile:
  • The first tool, colorspace:camera, simply assigns the color primaries from dcraw’s adobe_coeff. The actual transform to a display space isn’t occurring until the end of the processing chain, where the tone:filmic tool is checked (the tool with the check is the one displayed), and that is to the calibrated monitor profile.
  • The image stays in its original numerical scale until blackwhitepoint:data, where it is scaled to fit the 0.0 - 1.0 range, where 1.0 is display white.

Now, let’s stick the whitebalance tool with the as-shot multipliers in a few places, see what happens. First, after subtract, before demosaic:


This is where I usually put it, looks okay This requires a rawdata-specific version of whitebalance, in order to walk the mosaic properly. Now, let’s move it to after demosaic, where the image is now RGB:


Looks the same to me. Actually, in the screenshot the after-demosaic application appears less color-saturated. Now, let’s move it to the end, after the scale to display-white:

Some of the channels in highlights are pushed past 1.0, and they aren’t clipping well…

Just read @afre’s post, and I feel compelled to relate that I’ve come to think differently about the working profile since I wrote that. In my raw processing, I’ve stopped converting to a working profile; I just do all my raw work in the camera space, with a conversion to an appropriate output profile for display or saving to a file. Now, if I were to save a high-bitdepth TIFF for opening in GIMP, I’d convert to a large-gamut working profile for the TIFF.

There’s one reason I’d return to an early conversion to a working profile, and that would be if I could perfect the workflow to use a non-whitebalanced target shot camera profile to do the whitebalance in the chromatic conversion. Right now, I’m just too lazy to shoot the target in my sessions… :smile: