The RAW file is often called the "digital negative." The description is evocative but imprecise. A RAW file is not yet an image in the usual sense: it is a record of what the sensor measured, before almost all the choices that turn those measurements into a photograph. Understanding what it contains helps you decide when it is worth using and how best to develop it.
The sensor does not see color
Each photosite on a digital sensor measures only how much light hit it during the exposure. It knows nothing about its wavelength. To obtain color information, a mosaic of tiny colored filters is placed in front of the photosites.
The most common is the Bayer filter, which repeats a 2 × 2 pattern:
R G R G R G
G B G B G B
R G R G R G
G B G B G B
Half the photosites are filtered green, a quarter red and a quarter blue. Green is favoured because our perception of brightness and detail depends mainly on the central part of the spectrum.
An important fact follows: a 24-megapixel sensor has 24 million measurements, but each concerns a single color. Two thirds of the color information for each final pixel has to be estimated.
There are alternatives: some manufacturers use different mosaics, such as Fujifilm's X-Trans pattern on a 6 × 6 grid, and there have been layered sensors measuring all three colors at the same point. But the estimation principle remains the most common case.
Demosaicing
The process that rebuilds a full-color image from the mosaic is called demosaicing. The simplest approach interpolates, for each pixel, the missing colors from the average of same-colored neighbours. It works, but it produces soft edges and artifacts.
More advanced algorithms are adaptive: they analyse the direction of edges and interpolate along the edge, not across it. This prevents a sharp line between black and white from filling with colored fringes.
Typical demosaicing artifacts are:
- false color: colored specks or fringes on fine black-and-white detail, such as hair, fabric, grids;
- color moiré: on regular textures finer than the sensor grid;
- maze artifacts: small artificial structures in low-contrast areas, produced by overly aggressive algorithms.
Many cameras have an anti-aliasing filter in front of the sensor that slightly softens the image precisely to limit these defects; others omit it to gain sharpness, accepting a greater risk of moiré.
What a RAW file contains
Besides the mosaic values, a RAW file typically includes:
- 12- or 14-bit data per photosite, so 4,096 or 16,384 levels;
- linear values: proportional to the light received, with no gamma curve;
- shooting metadata: shutter speed, aperture, ISO, lens, orientation;
- the white balance chosen in camera, as a mere indication, not applied to the data;
- an embedded JPEG preview, the one we see on the camera's display and often in file viewers;
- calibration information such as black level and saturation level.
Each manufacturer uses its own format, often not publicly documented. The DNG format, proposed by Adobe as an open standard, is an alternative adopted by some cameras and many smartphones.
The choices RAW postpones
When the camera saves a JPEG, it makes many irreversible decisions on our behalf. With RAW those decisions are postponed to development:
| Decision | In JPEG | In RAW |
|---|---|---|
| White balance | applied, only partly recoverable | adjustable without loss |
| Tone curve and contrast | applied | yours to choose |
| Color space | usually sRGB | chosen during development |
| Noise reduction and sharpening | applied | adjustable |
| Depth | 8 bits | 12–14 bits |
| Highlights | often clipped by the curve | room for recovery |
The headroom in the highlights is particularly useful: 14-bit linear data often preserves detail in a sky that already looks pure white in the JPEG. What is truly saturated on the sensor, however, cannot be recovered in any format.
Drawbacks to consider
- Size: a RAW file takes two to six times as much space as a high-quality JPEG.
- Time: every shot needs developing, at least automatically.
- Compatibility: a very recent camera model may not yet be recognised by your software, and little-used proprietary formats can become hard to read over the years.
For archiving, my advice is to keep the original RAW, possibly a DNG copy, and the developed JPEGs or TIFFs you actually use.
In short
- Each photosite measures only the quantity of light; color comes from a filter mosaic, usually Bayer.
- Demosaicing estimates the two missing colors for each pixel and can produce false color and moiré.
- A RAW file contains 12–14-bit linear data, metadata and a JPEG preview.
- White balance, curve, color space and sharpening are decided during development.
- The benefits are flexibility and highlight headroom; the costs are size, time and compatibility.