Best practice for "unexpected white balance coefficients" in darktable

I’m trying to understand how to use the modern chromatic adaptation flow on the raw photos I shoot with my Sony A7IV. The darktable manual states the following:

Some cameras, most notably those from Olympus and Sony, have unexpected white balance coefficients that will always make the detected CCT invalid even for legitimate daylight scene illuminants…
It is possible to alleviate this issue…
4. Save a preset for the white balance module with these coefficients and auto-apply it to any color RAW image created by the same camera.

Since the suggested preset is made independent of any actual photo I might want to edit (it’s just done on a calibration photo of a 6500K white screen), it sounds like the manual is advocating using the white balance module not for any actual white balance, but rather as a kind of camera-calibration pre-processing step, after which I would use the color calibration module to adjust for the lighting conditions of an actual photo I want to edit. Is my understanding correct?

My next question is whether the photo needs to be of my white monitor or just something white? In particular, if I have a high-CFI video light panel with a calibrated color temperature that I suspect is better than my monitor, can I also just take a blurry picture of a 6500K light panel? My ideal would be to calibrate everything once and then be able to use my presets to edit on both my desktop and laptop displays.

Another issue is that when I create and use the recommended white balance preset, I get a warning about “white balance applied twice” in both the white balance and color calibration modules. Should I ignore that warning and nonetheless set my lighting-specific white balance in color calibration anyway (as opposed to my camera-specific settings in the white balance module)?

Basically I’m wondering what a reasonable starting setting is for color photos shot with a Sony A7IV, and then which settings are reasonable for creative choices. For example, is it reasonable to use the colorfulness and brightness tabs of color calibration for creative reasons, or is the intent that creative choices be confined to color zones and color balance RGB?

Thanks for any clarity on these questions…

1 Like

Hi Frisco! And welcome.
I’m not all that well up on the WB side of the color calibration module, and in fact I often use the old ‘legacy’ setting i.e. not using CC. But I know that’s not recommended!
But I’ll respond as best as I can and others can correct me…

I think you’re pretty much spot on. Disregarding the steps to ‘alleviate’ the invalid CCT thing, that’s how the color calibration module works, when you have chromatic adaptation set to ‘modern’ in the preferences. The white balance module gets automatically set to ‘camera reference’, and you then handle all the white balance adjustments through the color calibration module.

The bit you refer to in the manual is how to correct things only IF they are wonky in the CC module. For example if the ‘daylight’ settings all have a magenta or green cast. I expect you got this but just making sure!

I think that should be perfect.

I believe that’s usual - you don’t get this if you use that standard ‘camera reference’ preset, but I think any other settings in the WB module will cause that. The warning can be safely turned off, IIRC.

In the absence of any problems, I would use the defaults that you get when the chromatic adaptation is set to ‘modern’. That is, WB module set to ‘camera reference’ and CC module set to ‘as shot’.

From there, getting into personal likes and dislikes a bit more, so is is very much FWIW my workflow would be to switch on sigmoid (I have ‘workflow’ set to none in the prefs so I don’t get filmic or sigmoid by default) , and set the sigmoid contrast to a likely spot, adjust exposure, (I often juggle these two) then move to tone EQ if the highlights or shadows need pulling back.
Then I move onto colours…

It is reasonable! I find all those very useful… It’s best to make a new instance of the CC module if you want to use the more creative controls. just to separate them from the bread-and-butter wb work.
BTW the channel mixer can be useful creatively too. Takes a little while to get the hang of it but works very well for broad yet subtle hue shifts.

Hope this helps a little :slightly_smiling_face:

Thanks for the response. What I will say is that currently the colors look absolutely terrible with the defaults. My goal is to get my colors by default to the point that they are at least somewhat competitive with the JPEGs I get out of camera, because there are all kinds of other features that I want to use from darktable that I can’t do with the JPEGs.

As far as I can tell, this seems to be not so much a problem with darktable, as the fact that darktable is not trying to give me “opinionated” colors by default. So right now what I sometimes do is spend a lot of time fiddling with the color settings, particularly the R, G, and B tabs of color calibration, until I get something that I like. On some photos I can do it, on others I give up, because I seem incapable of getting the colors to look as good as the camera JPEGs. One note that particularly confuses me in the manual is this:

Note: The “R”, “G” and “B” labels on the channels of the color spaces in this module are merely conventions formed out of habit. These channels do not necessarily look “red”, “green” and “blue”, and users are advised against trying to make sense out of them based on their names. This is a general principle that applies to any RGB space used in any application.

So this makes me think I’m doing something wrong by trying to understand these colors and use this module for creative choices. For instance, if I want my foliage more green, I might turn down the R output for G input and compensate by increasing the R output for R input slightly, but obviously this only makes sense if R is “red” and G is “green.”

I was hoping that I could get better colors by default by compensating for the fact that Sony cameras have wonky colors. You are saying it is safe to ignore that warning, so I might try that. (Is there a way to disable one particular warning about a duplicated white balance?) Thanks.

Don’t worry, you’re not alone… dt can be a little shocking that way to start with :wink:
And I should say I don’t have a modern Sony so maybe there’s more going on than I’m aware of. I do find that sigmoid instead of filmic makes a difference (for me).
I’m not sure about this:

It’s not that bad, but it’s also not quite as simple as:

either! The trouble is that hues can shift too - the colorfulness and brightness tabs are straightforward though.
Would you like to post a Raw file, one that you’re happy to share? I always like the challenge of matching this sort of thing. :wink:You just need to state a licence, like in this post for example: Out of Africa (Kruger National Park)

I’m just downloading an A7IV Raw and jpeg pair now… I’ll see what’s going on. Stand By! :grin:
Update… having trouble finding a file that’s not taken on the lossless compressed setting which dt can’t open. Still looking…

OK, I found a couple on Can’t show the images here, but I did a rather quick and simple match to the jpegs and saved it as a style. Here it is:
Test_for_sonyA7IV.dtstyle (3.1 KB)
Can you download it and see how that looks? You can import it into the styles module in lighttable on the righthand side, then apply either from that module or with button at the lower left corner of the darkroom view.
Apply it to an image you haven’t done anything else to, or reset it first by clicking discard history stack in the history stack module in lighttable view (righthand side).
It won’t be an exact match, and you may need to adjust exposure. But I’d like to know whether it looks reasonable or not

Gladly! Here’s a raw file:
20230106_0126.ARW (34.8 MB)

And here’s the JPEG I get from the camera:

I may have had the “VV” (vivid) picture profile enabled. In darktable, if I tweak the colors enough to get that nice rich royal blue to be the same, then I lose the purples which turn blue.

I would love to know A) how to get something approximating the JPEG colors in darktable, and B) if there’s a way (possibly by abusing the white balance modue) that I can create my own presets that I can use to apply to multiple photos. Aurélien Pierre, in his videos, seems to imply that before doing that, I need to fix the “objective” part of color, like the white balance, so that’s where I got started and am confused.

P.S. I release the photos under CC-BY-SA license.

1 Like

Thanks! I’ll try that in a mo. The blues are a point… the way darktable handles colours has been known to have issues with those deep blues. I’ll see what I get with the style (the dt version of ‘presets’ in lightroom) I posted a moment ago, and tweak from there.
Oh… it looks like the raw file hadn’t finished uploading when you posted. Could you try again when you have a chance?

It’s good now!

How about this?

20230106_0126.ARW.xmp (9.8 KB)
You can load the xmp via the lightable to see what I did.
Or here’s a style:
test_no2_A7IV.dtstyle (3.5 KB)

I forgot to include the ‘filmic - off’ in the styles, so you need to turn it (or basecurve if it was on) off when you use the two styles I made. Ooops. :slightly_smiling_face:

That’s pretty good, but the blue still looks a little duller in the darktable version. I don’t know if that’s because the color blue is different, or if it’s because the surrounding colors are different. For instance in the darktable version the blown-out highlights above the right side of the blue reflection in the puddle are a big bigger.

This is not really scientific, but I used the gcolor2 color picker just to pick the colors from my browser at a point halfway between the top of the reflected head and the purple splotch bellow it in the puddle. On the JPEG with four different trials, I got


On the one you edited, I got the following, which is pretty close:


I mean that’s probably close enough that it isn’t the color itself that I prefer about the JPEG, but something else. I guess I’m ignorant about color that I can’t really articulate why I prefer the original from-camera JPEG, but I know color perception has a lot to do with surrounding colors and brightness as well.

Yes… it actually looks better in darktable, as opposed to on the browser. I may have a color management issue :flushed:
Tweaking the contrast (in sigmoid) and saturation (in color balance rgb) might fix it.
Still, I’d say it’s fairly close.(IMHO) :nerd_face:
Anyhow, have a look at the settings I used, and you’ll probably get it even better…

This issue in general, i.e. terrible colors is a bit of a darktable classic.
It’s just that every other Raw developer applies adjustments by default and dt doesn’t!
Filmic rgb doesn’t help sometimes either. Which is one reason why I really like sigmoid.
All I did to get that edit was adjust sigmoid, exposure, color bal rgb and a small tweak in the color calibration channel mixer to get the blues a little closer. Oh, also turned on a sharpening preset in diffuse or sharpen. So it’s a starting point I guess

On the bright side, I don’t believe you need to worry about the white balance preset business - it seems pretty close to me.
That wouldn’t actually change the colors anyway, only the settings that you set to get to a certain white balance - if that makes sense. OK, I’ve been computing too long, I need to head off before I say anything nonsensical (if I haven’t already!)

One more version before I go - a little more punchy :grinning:
Good luck, btw! I also forgot to say, nice photo!

20230106_0126.ARW.xmp (15.4 KB)

Well, I asked a neutral third party which version they preferred, and they liked your edit better than the camera JPEG. So maybe I like colors to be overly vivid to the point of being a little tacky and darktable will save me from myself, but it would still be nice to know how to replicate the JPEG.

My not very good understanding from watching the Aurélien Pierre videos is that I can fix any individual photo without doing the white balance properly, but that if I want to develop styles that work across photos, it’s something I need to fix. Is this not right?

Anyway, just saw the “punchy” version you posted, and I like that a lot more. So that gives me plenty to digest as I figure this whole color thing out. Thank you for your help.

1 Like

I suggest giving this section of the manual a very good and detailed read. I’m linking the 4.2 draft version of the manual.

Then watch these two videos:

1 Like

One thing to remember …getting the jpg colors and getting the right colors are not the same. And white balance in theory should be used more for the right colors… Using a color card you can do some things to set up your camera for the right colors and then can edit from there… if instead you are trying to match the jpg there are ways. Darktable chart is now working or you can try to manually match your jpg reference…legacy wb is perfectly safe and if it gives you good results no problem to use it… modern white balance performs a CAT using all the rgb data but does rely on those reference values which are off for some camera’s… If you don’t have weird lighting or are not needing to mask for a dual illuminant or wb maybe just stick to legacy …and resort to modern for more complex lighting situations… For sure if you have a color chart run it through color calibration color checker adjustment to see how far off it is and how much better you can make it…

Yes, it is. What I meant was that you don’t need to do the business with the 6500K white… frame… whatever. That’s effectively for setting up the internal translation from the file to the settings that you set in color calibration. But when things are working how they should, that’s already done in the background, and all you need to do is use the controls in the CC module to set a neutral white balance, so that things that are white or gray look white or grey as well.
Having said all that, in my opinion with some photos like the one above, there isn’t necessarily a ‘correct’ white balance and some theory may go out the window. Just my view, I hasten to add!

At what point are you assessing color…are filmic or sigmoid active or other modules…these can change the colors quite a bit so to initially understand the colors you are getting from your input profile and display profile you need to do so before those are in play IMO…

rename it cr3 and it will likely open…

1 Like

DT has a lot of color science…just looking at your jpg for sure the blue is likely way out of gamut… DT will fight you esp if you use v6 ie the most recent version of filmic… If you have a color chart you can do jpg / raw pairs and create a clut tone curve that will help to match them but chasing jpg colors from raw files as you might see by searching the forum is generally not worth the time and effort. You will rarely find a consistent formula… if you like the jpg… just use it …when its crap edit the raw file…

A simple formula for punchy is get your exposure right, apply filmic, set white and black levels… 150% local contrast and one of two 15% global chroma and 30% global saturation or 20 and 40 if you need more…

Using that general approach and filmic v5 which is my preferred version… I came to this… Not really trying for an exact match of the jpg just trying to capture something in the ball park… using legacy wb which I alway do for some image that I don’t own the camera and have not confirmed the D65 coefficients for…

You could easily tweak the brightness of the blues or the hue or saturation in 2 or 3 different tools