Questions regarding White Balance

With respect to White Balance (WB) it appears as though Rawtherapee (RT) operates with what it calls the “Camera” method as the default choice for the initial setting of WB. According to Rawpedia that means the following:

Takes the white balance used by the camera. If you shoot only in raw (so no raw+JPG), put the white balance settings of your camera on auto. This should generally give good results.

When saying “result” it appears as though that means determining the initial values that get set for “Temperature”, “Tint”, and “Red/Blue equalizer”. I think temperature is measured using a unit referred to as “Kelvin” which corresponds to differing light conditions for the scene that is the subject of the photograph. A chart acquired from other sources suggests a range of light conditions as follows:

Color Temperature 	Light Source

1000-2000K 	 		Candlelight
2500-3500K 	 		Tungsten Bulb (household variety)
3000-4000K 	 		Sunrise/Sunset (clear sky)
4000-5000K 	 		Fluorescent Lamps
5000-5500K 	 		Electronic Flash
5000-6500K 	 		Daylight with Clear Sky (sun overhead)
6500-8000K 	 		Moderately Overcast Sky
9000-10000K	 	Shade or Heavily Overcast Sky

In an example with which I am experimenting a raw file was obtained for a scene shot in normal outdoor sunlight. The initial value for Temperature ends is being set at 8969K (kelvin I think ?). If I change the “Method” to “AWB Auto” it gets changed to 9960K. These values are way different from what I’ve experienced in the past. I’m pretty sure the reason for that is because this raw file was produced by my new camera that creates such files in Canon .CR3 format. Apparently, RT Version 5.8 is unable to read the metadata from such files.

This creates a desire to know a little more about how these WB parameters are computed than what is explained in Rawpedia. As part of this experiment I did convert the raw file to Adobe Digital Negative (.dng) format. When I open the same camera shot with the raw file file converted to .dng format the Temperature ends up being 6119K with “Method” set as “Camera” and 6517K with “Method” set as “AWB Auto”. These are in the range I would expect.

Therefore, when it comes to metadata the question becomes “what metadata?” and “how is it used to determine these WB settings?”. In this case, the metadata element referred to as “White Balance” is set to “Auto” in both (cr3 and dng) files. An element referred to as “Color Temperature”, set to 5200, is present in the original camera produced (.cr3) raw file but NOT in the .dng format file.

Given that whatever value for “Temperature” is used to develop the raw file it DOES NOT get preserved in the form of metadata in the resulting image file (or any place else as far as I can figure) why does it matter what value was used? In that, how authentic are these temperature values even in the best case? Since it seems there is no absolute correct value is it possible that the huge discrepancy experienced here is NO more significant than the minor discrepancies normally experienced.

By the way, when Rawpedia says “If you shoot only in raw (so no raw+JPG), put the white balance settings of your camera on auto.”, what is the rationale behind that assertion?

First things first, “temperature” with regard to white balance is about the characteristics of the scene’s illuminant. After the image is captured and encoded to some form of RGB, it becomes a set of three numbers to which each pixel’s channels are multiplied, three numbers that are picked to make a pixel that’s supposed to be white, white. That is, R=G=B.

“Temperature” in your raw processor is a contrivance that has to be converted to the three multipliers to be applied to your image. The conversion is a bit of a kludge, with at least two discontinuities I know of, and the reason for a lot of “why doesn’t the raw processor color temperature look like what I think it should be?” questions.

So, in the metadata for most raws you won’t find any temperature tags, just multipliers. It’s because that’s what’s needed to white-balance the raw data.

For auto modes in-camera, the camera firmware goes through logic that is not available to us mere users to determine an appropriate white balance to record as “as-shot”. The basic algorithm is well-known, look up “gray world white balance” to find literature on it. There is more published research on white-balance algorithms, but what if any of it is being used in modern cameras isn’t published.

1 Like

I think that is what I’ve been starting to deduce. It looks, to me, like whatever number is used for temperature during development ends up disappearing. In that it does NOT appear anywhere in the resulting image file created by RT. However, the sliders used to revise the resulting image in the WB tool continue to work as expected no mater what number appears for temperature. Therefore, why should I/anyone care?

Do you know what those tags are called? and possibly where to find an explanation?

Sounds like I should be able to extract that information from my raw files even if RT cannot. However, that would only be useful if it were possible for me enter the missing data into RT. I sure don’t know how to do that but think if it’s possible more knowledgeable folks might know even if that were NOT the method intended by RT for users to undertake.

Yeh! but what does that have to do with whether or NOT I capture a jpg file in my camera? I don’t think the raw processor (e.g., RT) knows anything about the jpg file that could affect how the raw file is developed.

“Regular folk” don’t want to mess with three multipliers, so the mainstream softwares provide the “temp/tint” abstraction in an attempt to give one the notion of what they were dealing with in the scene, also in the software. The only place I’ve seen temperatures in metadata is associated with preset information.

exiftool. The single-handed mission of Phil Harvey to capture all things metadata. It’s a command line tool, but there’s a GUI front-end available. He also has an extensive database of information on all sorts of metadata tags:

Actually, RT does use the embedded JPEG in one tool, the Auto-Matched Tone Curve. It uses the JPEG to calculate a curve that can be applied to the raw data to approximate the JPEG processing. Has nothing to do with our current discussion… :crazy_face:

The cameras provide WB multipliers for raw processors to use because the camera was present at the scene where the light was inflicted. They’re used by the camera to produce the JPEG, but they’re also made available in the metadata for raw processors to have a decent starting point.

I’m quite familiar with ExifTool. Use it all the time. In fact, Phil personally helped me to recover the metadata lost by RT in my developed image files because of the inability of RT to process the metadata in CR3 format raw files.

However, I wouldn’t expect Phil or other ExifTool experts to be the right source for learning specifics about how RT uses metadata. I’d expect that the metadata in question is defined within the documentation for ExifTool but it is minutia contained among massive amounts of other elements.

Given that my interest is curiosity rather than knowing that I can do something useful with the knowledge I’m NOT wanting you or anyone else to waste your time trying to answer that question. Just thought if you know you could share.

I don’t think the embedded jpg (sometimes called the preview image) is the same thing as what is meant by setting the camera to produce jpg+Raw. Because of RT’s problem reading the metadata in my files it is also unable to obtain the embedded jpg (preview image). Therefore, I have to use ExifTool to recover it because I do like to know what it looks like when I’m developing my raw files. There is an extremely minimal amount of metadata in the embedded jpg.

However, that does raise another, possibly even more significant, question. Even though RT cannot obtain the embedded jpg from my CR3 format raw files the Auto Matched Tone Curve (AMTC) tool does seem to work. A problem that seems to occur with it is massive clipping in the highlights after applying the AMTC tool. Any ideas about that?

Having thought about it a little more, my guess is that the answer to my original question is that if the photographer is only producing raw files (with NO jpg file) then there is NO need for the photographer to use any of the other camera settings that affect WB. In that, NO reason to set something other the Auto when only producing raw files. Unfortunately that might be helpful to certain photographers but it fails to explain anything helpful with respect to raw file development using RT. I’ve never fiddled with those settings on my cameras and only capture raw files. I’m having to conclude that Rawpedia is NO help when it comes to understanding what RT does when the WB Method is set to “Camera” (which BTW I think is called “As Shot” in ART which has even less documentation).

It’s simply just pushing the highlights past the white point. I personally think it’s better to shape one’s own curve, and avoid that.

Really, its simple. RT and ART are taking whatever they can determine from the metadata as the as-shot white balance multipliers and applying them to the image. Almost too simple to explain…

Glenn already said the most important thing: the temperature and tint values in the GUI are concepts that only approximate the ‘real temperature’ of your scene. The software only needs to extract three channel coefficients (RGB) from the raw file in order to scale (‘white balance’) the raw data. Your camera writes these coefficients based on its white balance setting, and ‘Auto’ is usually good enough.
As far as I can see, RT can correctly extract these coefficients from CR3 files even though the rest of the metadata is not accessible (tested with the latest nightly build).

Edit: if you know how to read code, RawTherapee/ at 3ad786745cf11fade334ff41aad0573dfcd7c04e · Beep6581/RawTherapee · GitHub this is where the magic happens.
You can verify what is happening by locating your RawTherapee options file, set Verbose=true and run RawTherapee from a console (easiest on Linux). It will dump data like this

cam_mul:[2208.000000 1024.000000 1413.000000 1024.000000], AsShotNeutral:[0.463768 1.000000 0.724699 1.000000]
pre_mul:[1.000000 0.463768 0.639946 0.463768], scale_mul:[4.129489 1.915126 2.642649 1.915126], cblack:[512.000000 512.000000 512.000000 512.000000]
rgb_cam:[ [ 1.911071 -0.201531 0.046957], [-1.042678 1.719576 -0.628331], [0.131607 -0.518046 1.581374] ]
Raw As Shot White balance: temp 7039.272308, tint 0.957856

Where the cam_mul give you the scaling coefficients read from the camera.

Your explanation is helpful even if I might characterize it as a minimal tease. My point is that Rawpedia, which I credit with being pretty good especially for freeware, could be improved by saying at least that much.

1 Like

Something I have noticed is that image files that I develop with RT do contain a minimal amount of metadata even though I’m told RT cannot read metadata from CR3 format files (sample included below). This caused me to think that what I might characterize as the raw data portion of the file contains some data elements (information) embedded in the proprietary format that is needed for developing the picture and creating an image file. In that, where else might it come from? Per discussion herein that could include the kind of multipliers used to determine WB. Interestingly, even though RT seems unable to do any of the things that involve it identifying my specific camera that metadata included in the developed image files does include the identity of my camera, which must also be defined wherever this data is coming from.

With respect to code reading that is something I’m able to do but try very hard to avoid in favor of spending my time developing (and learning how) pictures.

***** Sample of metadata from image developed from CR3 format raw file follows:**

---- ExifTool ----
ExifTool Version Number         : 12.39
---- File ----
File Name                       : EOSR0061.RT58-Orig.tif
Directory                       : .
File Size                       : 173 MiB
File Modification Date/Time     : 2022:04:05 12:01:02-04:00
File Access Date/Time           : 2022:04:05 12:01:01-04:00
File Creation Date/Time         : 2022:04:03 22:45:27-04:00
File Permissions                : -rw-rw-rw-
File Type                       : TIFF
File Type Extension             : tif
MIME Type                       : image/tiff
Exif Byte Order                 : Little-endian (Intel, II)
---- EXIF ----
Image Width                     : 6736
Image Height                    : 4492
Bits Per Sample                 : 16 16 16
Compression                     : Uncompressed
Photometric Interpretation      : RGB
Make                            : Canon
Camera Model Name               : Canon EOS R
Strip Offsets                   : 4636
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 3
Rows Per Strip                  : 4492
Strip Byte Counts               : 181548672
X Resolution                    : 72
Y Resolution                    : 72
Planar Configuration            : Chunky
Resolution Unit                 : inches
Software                        : RawTherapee 5.8
Modify Date                     : 2022:03:16 08:13:47
Artist                          : 
Sample Format                   : Unsigned; Unsigned; Unsigned
Copyright                       : 
Exposure Time                   : 1/20
F Number                        : 22.0
Exposure Program                : Aperture-priority AE
ISO                             : 100
Sensitivity Type                : Recommended Exposure Index
Recommended Exposure Index      : 100
Exif Version                    : 0231
Date/Time Original              : 2022:03:16 08:13:47
Create Date                     : 2022:03:16 08:13:47
Offset Time                     : -05:00
Offset Time Original            : -05:00
Offset Time Digitized           : -05:00
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/21
Aperture Value                  : 22.6
Exposure Compensation           : 0
Metering Mode                   : Multi-segment
Flash                           : No Flash
Focal Length                    : 50.0 mm
User Comment                    : 
Sub Sec Time                    : 93
Sub Sec Time Original           : 93
Sub Sec Time Digitized          : 93
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 6720
Exif Image Height               : 4480
Focal Plane X Resolution        : 4621.733154
Focal Plane Y Resolution        : 4671.532847
Focal Plane Resolution Unit     : inches
Custom Rendered                 : Normal
Exposure Mode                   : Auto
White Balance                   : Auto
Scene Capture Type              : Standard
Owner Name                      : 
Serial Number                   : 372022000364
Lens Info                       : 24-105mm f/0
Lens Model                      : RF24-105mm F4 L IS USM
Lens Serial Number              : 1154006479
GPS Version ID                  :
---- XMP ----
XMP Toolkit                     : Image::ExifTool 12.39
Rating                          : 0
---- ICC_Profile ----
Profile CMM Type                : Little CMS
Profile Version                 : 4.3.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2018:11:13 11:18:51
Profile File Signature          : acsp
Primary Platform                : Microsoft Corporation
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : 
Device Model                    : 
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Little CMS
Profile ID                      : 0
Profile Description             : RTv4_sRGB
Profile Copyright               : Copyright RawTherapee 2018, CC0
Media White Point               : 0.9642 1 0.82491
Chromatic Adaptation            : 1.04788 0.02292 -0.05022 0.02959 0.99048 -0.01707 -0.00925 0.01508 0.75168
Red Matrix Column               : 0.43604 0.22249 0.01392
Blue Matrix Column              : 0.14305 0.06061 0.71391
Green Matrix Column             : 0.38512 0.7169 0.09706
Red Tone Reproduction Curve     : (Binary data 40 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 40 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 40 bytes, use -b option to extract)
Chromaticity Channels           : 3
Chromaticity Colorant           : Unknown (0)
Chromaticity Channel 1          : 0.64 0.33
Chromaticity Channel 2          : 0.3 0.60001
Chromaticity Channel 3          : 0.14999 0.06
Device Mfg Desc                 : RawTherapee
---- Composite ----
Aperture                        : 22.0
Image Size                      : 6736x4492
Megapixels                      : 30.3
Shutter Speed                   : 1/20
Create Date                     : 2022:03:16 08:13:47.93-05:00
Date/Time Original              : 2022:03:16 08:13:47.93-05:00
Modify Date                     : 2022:03:16 08:13:47.93-05:00
Light Value                     : 13.2
Scale Factor To 35 mm Equivalent: 1.0
Circle Of Confusion             : 0.031 mm
Field Of View                   : 40.4 deg
Focal Length                    : 50.0 mm (35 mm equivalent: 48.9 mm)
Hyperfocal Distance             : 3.70 m
Lens ID                         : RF24-105mm F4 L IS USM

Have tried setting your camera’s WB to “sunlight” for all outdoor work?

I found that even with all settings of the camera (Nikon d850) on Manual, I was still getting changes in color of multiple images of the same scene. Using the “sunlight” setting for WB cured that issue.