RAW or JPEG?
Should you set your camera to record RAW digital images or JPEG images?
A RAW image file contains all the information your camera's sensor 'saw' when you pressed the shutter. RAW files contain a lot of data. In his book, The Digital Negative, Jeff Schewe describes it as the 'cookie dough'.
A JPEG file is a 'compressed' file that is engineered to decrease file size by eliminating 'redundant' data. But that isn't all. JPEG files that are created by software in the camera, are not only compressed, but they have certain image characteristics 'baked in' (as Jeff Schewe says) reflecting the preferences of the engineers who created the software. Decisions that you might want to have made, have been made for you. Once those changes have been made and 'baked-in' you can't unbake them because data has been discarded.
One of the aspects of the 'baking' that is done when a RAW file is converted to JPEG is to change the tonal distribution in the file. A RAW file has what is called a 'linear gamma'. Basically what that means is that a sensor is a linear device. If you double the number of photons hitting the sensor you will double the output of the sensor. Change the light level, and the sensor output changes proportionately. In a JPEG file, a different 'gamma' is encoded — usually to make an image file that has more obvious contrast but also in recognition that human vision does not respond to tonal changes linearly. In itself, that change doesn't sound like a bad thing, but part of the process is to compress the highlight areas of the image where RAW file manipulation can potentially extract a lot of image detail. Early conversion to JPEG eliminates that possibility.
Some cameras convert their RAW files into 8-bit JPEG files, where the RAW image data was 12-bit (or more).
A digital camera records about 8 stops of light. That means, from the maximum light level recordable (all photosite switches are 'on') you can halve the light level 8 times before you reach a level too low to be recorded.
To illustrate the point, this diagram represents the difference between recording 8 stops of light on a 25 level sensor as compared to a 75 level sensor. You can see that a 25 level sensor does not distinguish the last three stops of light — all of those tonalities would be recorded (and later printed) as the same value. The more switches, the greater the degree of separation.
As described previously a typical digital camera records light on a 12-bit sensor which can record 4096 different light levels — in this analogy it has 4096 switches. The RAW digital image file can represent all of those 4096 levels. Roughly 512 switches (different levels) can record the actual amount of light on those last three stops.
An 8-bit system has, effectively, only 256 levels to capture all 8 stops of light. In that system, only 3 switches can record the final 3 stops of light.
In other words, an image file that has been converted to an 8-bit JPEG file is incapable of discriminating light levels in the darkest regions.
The same is true for the brightest levels. A 12-bit RAW file can discriminate 2048 different levels of light in the brightest half of the tonal distribution. An 8-bit JPEG can discriminate only 128 levels there.
The effect of these limitations is most keenly felt when you are using a program like Photoshop to make subtle tonal shifts. Fewer available levels means 'step' shifts that can result in posterisation' in images (like obvious boundaries of colour or tone in subtle skies, for example.)
The more data you have to adjust and print with, the better.
Recording in RAW is best.
JPEG files made 'in camera' constrain your options