How is value for "Original Temperature" determined?

In GIMP 2.10 it looks like there is a new tool for adjusting color temperature (i.e., Menu>Color>Color Temperature). It looks a lot like one of the available methods for adjusting White Balance in other image editing software products to particularly include raw processors. I realize that GIMP is not a raw processor and only handles images that have already been developed (i.e., had white balance or color temperature applied). Intuition suggests that “Original Temperature” refers to the color temperature used to create the image being viewed before the tool is applied. If so, how is an accurate value to be determined? If not, what is it?

Hi David,

I might be extremely off here, but I believe that “original temperature” is what the camera reported and inserted into the image file.

More here: 8.3. Color Temperature

Have fun!
Claes in Lund, Sweden

Addendum: Sorry, I was quite off. Correct replies below.

Sounds like you are going along with my intuition but I haven’t been able to figure out how to find it. I’m thinking there are some different scenarios that come into play. “Color Temperature” (CT) is a term that is closely associated with “White Balance” when processing raw files, which is something that cameras do automatically. While users might be able to influence the camera by specifying different settings the actual development does not involve the user. To the extent cameras use metadata to preserve quite a lot of information about the shot which could include data about it’s development I’m afraid that each camera has its’ own way to do this. That would offer a plausible explanation for why GIMP expects the user to supply it.

Another consideration is that CT seems to apply to photography but there are lots of possibilities for images that did not originate with a camera that can be edited with GIMP.

Anyway with my Canon camera there is a metadata element called “Color Temperature” however it does not appear to have anything to do with the developed image. It never changes in shots taken in extremely different settings (i.e., moonshine vs sunshine). My supposition is that it is related to camera settings and I haven’t changed whatever it is that might cause it to change. I’m pretty sure this value cannot pertain to the images produced by the camera.

I doubt that the tool looks into the “original temperature” metadata of the camera, whatever that means. Based on the manual, it looks like both values are intended to be manually set by the user.

Some cameras do have metadata that indicate the measured Kelvins and / or measured RGGB values. My Canon camera only has the latter. However, this might not be useful for our purposes.

The thing to note when using this tool is to consider the difference between the original value and the intended value. That would be the amount you would want to shift the colours.

Yes, @afre’s description is correct. GIMP doesn’t look at the image metadata. The user must set both sliders. This isn’t a full-fledged tool for correcting color temperature, though it does often make nice results.

OK! Sounds like the answer is that some cameras provide metadata indicating what temperature the camera used to develop an image. However, with my Canon camera such information is not supplied. Therefore, I’m just out of luck when it comes to knowing what value to supply for Original Temperature on the GIMP Color Temperature tool but others are better off.

Even though my camera won’t tell me what value it chose for a particular shot I could make a guess that might be better than always using the default value of 6500. This might also work for at least some images that I didn’t shoot. Do any of you more experienced photographers have an opinion about whether or not that is worth the effort? It looks to me like the choice of 6500 for the default value may have more to do with being middle of the scale than anything else.

I have undertaken some pretty subjective experiments and find that I can’t really tell that it makes any difference what the Original Temperature is set to if the increment for increase or decrease to obtain Intended Temperature is the same. In that does it really matter? Or maybe under what conditions is it going to matter?

Try making a +3000 increase in Temperature using GIMP’s color temperature operation. First try starting from a temperature of 2000 and increasing to 5000. The try starting from 8000 and increasing to 11000. I see quite a difference. Do you?

Are you sure? My old Canon camera does have color temperature information that can be seen using “exiftool /path/to/file”, for example:

WB RGGB Levels As Shot          : 730 1096 1096 1027
Color Temp As Shot              : 2950
WB RGGB Levels Auto             : 2515 1024 1024 1646
Color Temp Auto                 : 4984
WB RGGB Levels Measured         : 2512 1018 1029 1645
Color Temp Measured             : 4984

Of course auto temp is easily fooled. And the temeprature as shot might not have any relationship to the actual temperature of the ambient light.

The thing is, GIMP’s code for Color Temperature is a lookup table derived from, well, I’m not exactly sure what the original calculations were based on. That table is very old, though results are pleasing.

The right way to code a color temperature tool is to do a Bradford chromatic adaptation on the colors in the image, from a presumed starting temperature to the desired destination temperature. Even this sort of operation leaves to one side “color of the light” considerations that move along the magenta-green axis.

IMHO the best use for GIMP’s Color Temperature operation is “move the sliders until you like the look” and forget about “are these really the right colors”.

If you don’t like results from GIMP, I’d suggest using RawTherapee, darktable, PhotoFlow, etc, all of which have green-magenta sliders as well as color temperature sliders. But it really depends on your goal. And changing the presumed starting temp does affect the output.

If you try all these softwares, please share your results here!

Are you trying to white balance an improperly white-balanced image? For the “top of the line” approach for this situation, if none of GIMP/darktable/PhotoFlow/RawTherapee color temperature sliders work for you, and doing a normal white balance by clicking on a nominally neutral “gray patch” isn’t working for you, you might try RawTherapee’s CIECAM module.

Or maybe you are going for an artistic change in the overall image “color of the light”? All the tools will work, but again RawTherapee’s CIECAM module is excellent, though the learning curve is a bit steep and the full array of stuff to try is overwhelming.

I’ve been messing with demosaic of the raw array, and the metadata RGGB multipliers are definitely expressed with respect to the CFA bias toward green. I haven’t looked at any other than ‘daylight’ images to see if there’s a color temperature component captured in them.

The same information is still there for a less old 80D.

Yes I do! But what’s surprising is how big the difference is when doing 2000->5000 verses 8000->11000. The 2000->5000 makes a big difference whereas the 8000->11000 results in very minimal change.

I’m very unsure about any of this right now. All of the metadata from my camera which looks, to me, like it involves WB & CT for a shot that I’m experimenting with follows:

WB Shift AB : 0
WB Shift GM : 0
Measured RGGB : 496 1024 1024 604
Color Space : sRGB
Sensor Width : 5344
Sensor Height : 3516
Sensor Left Border : 152
Sensor Top Border : 56
Sensor Right Border : 5335
Sensor Bottom Border : 3511
Black Mask Left Border : 0
Black Mask Top Border : 0
Black Mask Right Border : 0
Black Mask Bottom Border : 0
Color Data Version : 14 (1300D)
WB RGGB Levels As Shot : 2140 1024 1024 1636
Color Temp As Shot : 4960
WB RGGB Levels Auto : 2140 1024 1024 1636
Color Temp Auto : 4960
WB RGGB Levels Measured : 2140 1024 1024 1636
Color Temp Measured : 4960
WB RGGB Levels Daylight : 2106 1024 1024 1526
Color Temp Daylight : 5200
WB RGGB Levels Shade : 2427 1024 1024 1301
Color Temp Shade : 7000
WB RGGB Levels Cloudy : 2265 1024 1024 1406
Color Temp Cloudy : 6000
WB RGGB Levels Tungsten : 1524 1024 1024 2284
Color Temp Tungsten : 3200
WB RGGB Levels Fluorescent : 1846 1024 1024 2166
Color Temp Fluorescent : 3729
WB RGGB Levels Kelvin : 2106 1024 1024 1526
Color Temp Kelvin : 5200
WB RGGB Levels Flash : 2351 1024 1024 1387
Color Temp Flash : 6303
Average Black Level : 2046 2046 2046 2046
Per Channel Black Level : 2045 2045 2046 2046
Normal White Level : 11767
Specular White Level : 12279

The elements you referenced are included. However, in my mind what I’m looking for is what I’d call “As Developed”. In that, it seems to me that “As Developed” would be a property of the camera developed image. I’m not trying to quarrel about the terminology but if there is anything there that means as developed then I haven’t been able to figure it out.

That idea is pretty straightforward when working with 1 slider. But when it becomes 2 sliders what could be thought of as a discrete set of choices starts to look like an infinite number of choices. I’m pretty new to this business but I’ve been using a Windows computer and that has lead me to be experimenting with both GIMP and Rawtherapee (RT) as well as the Canon supplied software called Digital Photo Professional (DPP). Interestingly RT defaults to 6490 (pretty close to GIMP’s 6500) when editing standard format image type of files (i.e., non-raw file) with no ability to set an original temperature.

I think what I’m trying to do is learn how to edit digital images. I actually started by wanting to digitize our collection of family photos which brought me to GIMP and some pretty amazing results. This brought about some curiosity for editing certain JPG files also from the family collection. When I noticed how much latitude existed between what could be produced in a so-called digital darkroom verses accepting what cameras produced I became interested in taking pictures which for me, so far, primarily means landscapes and wildlife which present some opportunity for a former geek to try his hand at something that might have an artistic bent to it. This created the need to obtain some equipment capable of producing raw files that I can develop. Even though GIMP doesn’t handle raw files it still does some things that I like which aren’t possible with the photo centric software such as RT & DPP.

So raw is good but you cannot get away from the need to edit images that have already been developed.

When I came up with my question it seemed like something that ought to be a bit more straightforward than it is turning out to be. Even if there is an answer for how to do it with my camera that is no help for the mountains of image files I’ve acquired from elsewhere.

It sort of looks to me like there is no magic answer that can be applied to any, or even a good variety of, standard format image files (e.g., JPG, TIFF, etc.).

I think we should keep it simple.

1. Most apps have a dropper tool that balances the image based on a point or area. You could use that on a grey or close to grey area in your photo. There are many articles on that. Other tools have droppers too such as the levels tool.

2. There are auto-balance tools based on different theories and algorithms. One might not work for you but another might. I think GIMP has several builtin. G’MIC, a powerful plugin in GIMP, has many filters that deal with colour balance and manipulation.

The key is to find a representative photo from a set. Balance that and use the same technique on the others.

1 Like

+1 to @afre’s call for ‘simple’.

I found the color temperature thing to be unhelpful; I didn’t start to get good white balance until I used the patch/dropper method. Later, I learned to recognize out-of-alignment channels and to adjust white balance manually with per-channel curves.

Simply, white balance is about making white have identical values for the red, green, and blue channels. I think adjusting color temperature assumes your imbalance is mostly in the simple
spectral difference between what the camera asserts and the actual temperature, but a lot of light these days doesn’t cooperate with that assumption.

I just wrote a whitebalance tool for rawproc, and I skipped the whole color temperature thing…

I do understand that there are a variety of ways to attempt WB adjustment and I certainly don’t have enough knowledge or experience to offer any advice on what might be better.

My question was focused on understanding the Color Temperature (CT) Tool that turned up in GIMP 2.10. It may be that my understanding about some basic characteristics of WB is flawed. One basic idea that I have in mind is that the process of developing an image from the raw sensor data requires dealing with WB considerations. I also have the idea that CT ends up being a property that can be associated with this development process for all photographs. In that, no matter what method the user or camera uses to adjust WB the software ends up associating a CT with the process of developing raw data into an image. Is that a valid concept? If not then I need to get a better understanding of how WB works.

If so, then I’m thinking, there is a CT associated with the initial development of raw data into an image. Then that CT can be seen as a property of the image. Because GIMP does NOT develop raw data this is always done elsewhere. I’m thinking that this is why GIMP (correctly?) chooses not to refer to White Balance. My impression is that GIMP’s CT Tool wants to know what it is. Absent a standard method of tracking this property it is understandable that GIMP needs for the user to supply it and my question is simply how does GIMP think it is supposed to be obtained.

Another concept that I have is that once we start processing that initial image (i.e., file that has already been developed) with editing software an extensive set of tools come into play that pretty much all adjust the color in some way or another. Once we start doing that, I’m inclined to think that CT becomes less relevant and that it doesn’t take much to make it meaningless. Might this explain why there is no attempt to track WB (or CT) automatically such as by using an element of metadata? Might this be why experienced photographers don’t really expect there to be a way to find that initial value of CT? Maybe the CT tool in GIMP should be avoided except is those, possibly, rare cases where, as Elle says, it happens to produce a nice/pleasing affect.

@ajax Let us keep it simple and examine the output of dcraw, which is what I would call the grandfather of raw processors.

>dcraw -v sample.nef
Loading Nikon D3300 image from sample.nef ...
Scaling with darkness 150, saturation 4095, and
multipliers 2.393118 1.000000 1.223981 1.000000
AHD interpolation...
Converting to sRGB colorspace...

dcraw gathers information from its own database to determine the scaling levels; i.e. where the noise floor and saturation points are. Then it proceeds to read the multipliers from the metadata of the raw file, which were determined by your camera’s white balance settings (mostly based on defaults of and assumptions about the camera). As you can see, temperature is not a part of the equation; what the raw processor reads from the file is not the temperature.

Temperature, tint and kelvin are abstractions of these multipliers, based on what is assumed to be true of each colour array and individual pixels. You would need a colorimeter or spectrophotometer at the scene to tell you what the colour or wavelength of the light sources were exactly. Or at least have a grey or colour reference handy.

That said, colour replication would be impossible if you don’t have a good colour management habits, so consider colour profiling your camera, screen, printer, paper, etc., and consider the ambient temperature of the room where you are editing and where and how the images will be displayed and viewed. Before you know it, you turn into a colour expert. :rofl:

There is a gold mine of info on the web. Here are some links to get you started.

1 Like

@ajax - I agree with @afre and @ggbutcher - simpler is better. When white-balancing a raw file, as @afre noted temp/tint is an abstraction from the actual white balance multipliers. Agreeing with @ggbutcher, for just plain white balancing a raw file I’d just as soon not even see the temp/tint sliders. Even the various raw processors all have different temp/tints for nominally “the same” white balance (for example “daylight”), but the actual white-balanced image produced by each raw processor is very similar.

If the image isn’t a raw file, then find a nominally gray spot in the image and in GIMP use Levels to white balance, just make sure you set Levels to work on linear RGB and that the image is at floating point precision. You’ll probably need to move the lower Value slider to restore proper exposure - it’s easier to do this sort of white balancing in RawTherapee, darktable, etc than in GIMP.

On the other hand and depending on your goals, RawTherapee’s CIECAM02 module is considerably more than just an abstraction from raw multipliers. But again, there’s a learning curve, that’s well worth climbing depending on the goal, for example preserving or restoring the “color of the light” instead of white-balancing it away. But this would be digital image processing 201 or higher :slight_smile: maybe not so useful for most editing tasks.

1 Like

Color temperature is a property of the light that illuminated the subject (I looked that up). Once the image is captured by a particular sensor, the light’s color temperature is expressed as the ratios of the red, green and blue channels in the depiction of the color white (this is my conclusion, anyone feel free to correct me). So, the problem becomes aligning the individual channels so they make white do this: R=G=B.

In the olden days (my grandkids have told me anything earlier than 2008 are the olden days), color film emulsions were crafted to respond to the color temperature of light to make white R=G=B. Digital cameras have both that and the green bias of the CFA to worry, and the multipliers in the metadata correct for both.

So, bear-of-little-brain here thinks that messing with white balance using the channel multipliers directly makes more intuitive sense than using a color temperature slider to produce the multipliers. A color temperature slider on the camera, used to change the sensor response based on the actual light on the scene at the time of capture, would make more sense to me but it’s probably simpler to just hard-code the camera to one response and fiddle with the multipliers after the fact.

As always, FWIW…

Back to the original question, “How is the value for Original Temperature calculated?”

I’m not aware of a way to calculate it if you’re working with a non-raw file.

A test.

Here is a raw photo in RawTherapee, the white balance temperature is too high at 7600K, making the whole image too orange:

I saved the too-warm image as a 16-bit PNG file for later use:

I use the white balance picker to make the paper in the background neutral, which sets the temperature to 4500K:

Now open the too-warm PNG file in GIMP. Ideally GIMP would also have a pipette allowing you to pick a spot on the image which should be neutral, to calculate the optimal temp and tint for you, but GIMP 2.10.4 doesn’t have that yet, so you have to adjust the temperature manually.

GIMP does not know the original color temperature (how could it), so it sets both original and intended temperatures to a reasonable 6500K:

We know from RawTherapee that the correct temperature to balance the whites is 4500K. If you adjust the intended temperature in GIMP to 4500K, you get this:


The image still has an orange/yellow tint, because the source temperature is incorrect.

If you adjust the intended temperature visually to taste, you may arrive at 4000K which gives you this:


That is the best I could do, acting like I don’t know the source temperature. Note that the paper is close to neutral, but the rest of the photo still has a tint (the red flower is a dirty orange-red), and it does not match the correct 4500K image from RawTherapee.

If I set the intended temperature any less than 4000K it would make things even worse - the red flower is now less orange, closer to red but still “dirty”, and the paper has now turned bluish:

We cannot properly correct the white balance through setting the intended temperature without knowing the original temperature.

I was under the impression that if I set the original temperature to 7600K, which we know to be correct as that is what I set when I saved the image in RawTherapee, then setting the intended temperature to 4500K would result in an image identical to the 4500K one from RawTherapee, but it did not (compare this to the second RawTherapee screenshot):

3 Likes

More puzzles, this time in RawTherapee.

When you open the PNG in RawTherapee, it shows the temperature as 6490K and tint as 1.002 - why the 10K and 0.002 differences?

When I set the image’s original temperature to 6490K in GIMP and set the desired temperature to 4000K, the result is nothing like if I open the PNG in RawTherapee where the temperature defaults to 6490K and then set the temperature to 4000K:

1 Like

Should I convert to Fahrenheit? :stuck_out_tongue_closed_eyes:

Don’t think so.
6490K equals 11222.33 deg F.
Centigrade (Celsius) sounds a trifle better, since 6490K equals 6216.85 deg C,
at least that’s what Dr. Google has to say.

Have fun!
Claes in Lund, Sweden