Before the rush

Before the rush
by evan-pak

Submit your Photo
Hall of Fame

Please participate in Meta
and help us grow.

Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't understand how the camera can work out the white-balance to use in a given scene.

I could see it working if there is an obvious colour-cast (for example: under fluorescent lights). Does it compare the histograms from the different colour channels and try to make them match up to some degree? Even then I can only imagine it working reliably in very well-defined circumstances.

Can someone explain how it is implemented in today's cameras, and how well it typically works?

share|improve this question
up vote 16 down vote accepted

The original assumption is that the average scene should be color neutral and therefore by computing the average color in the scene and then applying the same correction to every pixel you would get a scene whose average color is neutral which should have the correct white-balance. This will fail when there is a dominant color and the scene.

Algorithms got more sophisticated over the years with lots of technical papers and patents written on the subject. They added more intelligence like clamping to the set of known illuminants.

The exact algorithm differs between cameras and it seems to work extremely well outdoors during the day, where there is little variation. Under artificial light there is much more variance and it is rather hit or miss. Older digital cameras were particularly bad but it has been improving on average.

The very best white-balance performance I've ever seen was on the HP Photosmart R967. DC Resource noticed this and commented that they should win the Nobel prize! Several recent compact cameras also do an excellent job. The advantage of a mirrorless camera over a DSLR for this is that it can read data from all over the sensor. DSLRs can now do that in Live-View mode.

Some DSLRs use an entirely different approach which is to measure white-balance instead. This is the case for the Olympus E-5. It has a dedicated 'external' sensor which measures the light falling on the camera. You can turn this off for cases when you are shooting from a different lighting than your subject.

share|improve this answer
Note: A DSLR without live view can still measure white balance using the entire sensor. The white balance is applied after capturing the image, as evident by the fact that the data stored in a raw file is before white balance is applied. – Guffa Dec 9 '10 at 17:54
@Guffa - I believe your logic is flawed, try to use a preset white-balance instead and the RAW file data won't have white-balance applied either. You are right though that any camera could do the white-balance computation post-capture but I have seen no evidence to it, perhaps it is a question of performance but I doubt it. If you read the specifications of a modern DSLR, such as the Nikon D7000, it says something like '2016 pixels white-balance sensor' which strongly suggests it is not done with the entire imaging-sensor. – Itai Dec 9 '10 at 18:14
I think it's a simple performance optimisation - you don't need to sample every pixel, and if you did you'd end up doing one raw conversion to measure the white balance, and then another conversion with this balance in hand – Matt Grum Dec 9 '10 at 19:06
@Reid - Note the use of the world 'original'. Camera makers do not publish their formula directly but you can read papers and patents on the subject to learn more. There are literally hundreds of ways it is done but I do not know of any that uses a reference images (metering is known to do it that way, but that is something entirely different), only reference illuminants. – Itai Dec 10 '10 at 3:00
PS: I actually do have a room with all pink walls :) – Michael Nielsen Mar 25 '13 at 7:49

The camera can't know what white balance to use, it can only make a guess based on the image data (or sometimes an external sensor, as Itai mentioned in his answer).

If I for example take an image of a blue wall, the camera thinks that I have taken an image of a gray wall in blue light, and the image ends up gray instead of blue. (This is pretty much the same phenomenon as when I photograph a white or black wall with automatic exposure, and the camera sets the exposure so that both end up gray.)

I always use automatic white balance, and adjust it manually when devloping from the raw image. My experience is that sometimes the automatic white balance is spot on, most of the time it's very close, and in some rare sitations it's way off.

Note also that the "correct" white balance setting isn't always the exact color temperature of the light source. Sometimes an image needs a slight color change to look natural, and some may even need quite a lot. An image taken in bright sunlight may need to be slightly more yellow, and an image taken in the blue hours may need a lot of blue.

share|improve this answer
Humm, but if I take a picture of a blue wall, it comes out blue, not white. I don't have my camera handy, but what about an off-white wall? Does that get pushed to neutral white? – Reid Dec 10 '10 at 2:49
good point about "correct" balance. – AJ Finch Dec 10 '10 at 11:46
Same here. I'll include some test shots in the same location, and start with a wb adjustment that I then apply to all the shots as a starting point. The other day I noticed that a correctly calibreated image looked cold/blue: the brain expects the scene to be amber, and although a non corrected photo looks orange, a little, warmth gives the right impression. – JDługosz Nov 30 '14 at 10:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.