Contrary to popular belief, white balance applied to an image is not a color temperature, itās three multipliers, one for each channel, that make a pixel that is supposed to be white, white.
The calculated color temperatures in raw processors is an approximation, with at least one discontinuity in the equation. The actual color temperature of a light in the scene can really only be measured in the scene; once the image is encoded to RGB, reverse-engineering it is a coarse approximation.
So, I took a RAF Iād downloaded for a PlayRaw and went looking for the multipliers. grepping for āWBā, I got this:
$ exiftool -G DSCF1505.RAF |grep WB
[RAF] WB GRB Levels Standard : 302 364 862 17 302 615 510 21
[RAF] WB GRB Levels Auto : 302 426 739
[RAF] WB GRB Levels : 302 426 739
So, āGRBā means the values are in green,red,blue order, and the āWB GRB Levelsā apparently are the āas shotā numbers. To get the multipliers, the R and B values need to be divided by the G value, so:
R = 426/302 = 1.410596
B = 739/302 = 2.44702
G = 302/302 = 1.000 (for completeness)
G is the anchor, and white balance is actually an adjustment of R and B so that for a white pixel, R=G=B.
exiftool does a convenient thing, in the Composite tags it provides a Red Balance and Blue Balance where the calculation is done for you:
$ exiftool -G DSCF1505.RAF |grep Balance
[MakerNotes] White Balance : Auto
[MakerNotes] White Balance Fine Tune : Red +0, Blue +0
[Composite] Blue Balance : 2.44702
[Composite] Red Balance : 1.410596
Now, for your questions:
It is widely assumed that camera manufacturers have their own unknowable algorithms for calculating as-shot white balance multipliers. There are good alternatives in the open research, with the fundamental one being the so-called āgrey worldā algorithm, look it upā¦
darktable has selectable presets, one of them is āas-shotā:
https://docs.darktable.org/usermanual/3.8/en/module-reference/processing-modules/white-balance/
I believe this preset will use the WB GRB Levels numbers from the metadata, Iām too lazy to inspect the code to confirm⦠
Anyway, more than you probably wanted to knowā¦