A sunset sky, a wall lit from the side, the smooth backdrop of a portrait: these are the areas where an image reveals its limits. Instead of a continuous transition, stripes appear, like the steps of a staircase. This defect is called banding and it depends on how many color levels are available for each channel, that is, on bit depth. Let's see how it is calculated, when it becomes a problem and which techniques reduce it.
Levels per channel
With n bits you can represent 2ⁿ different levels. For one color channel:
| Bits per channel | Levels per channel | RGB combinations |
|---|---|---|
| 1 | 2 | 8 |
| 5–6 (compact formats) | 32–64 | about 65 thousand |
| 8 | 256 | about 16.7 million |
| 10 | 1,024 | about 1.07 billion |
| 12 | 4,096 | about 68.7 billion |
| 16 | 65,536 | about 281 trillion |
The total number of combinations is impressive, but it is not what matters. What matters is how many levels there are along a single gradient. A gray running from black to white in an 8-bit image has at most 256 steps. A gradient from dark blue to medium blue, however, may use only 40 values: spread over an area 2000 pixels wide, each value covers a 50-pixel stripe, and the stripes become visible.
Why 8 bits are sometimes enough and sometimes not
For final display, 8 bits per channel in a gamma-encoded space like sRGB are usually sufficient: the curve distributes the levels so that the steps are almost invisible. Problems arise in three situations:
- Wide, low-contrast gradients, such as skies and studio backdrops.
- Heavy editing: every curves or levels adjustment "stretches" some ranges of values and compresses others. Lifting the shadows by two stops spreads the original 30 levels over a wider range, opening gaps between one level and the next.
- Wide color spaces, where the same 256 levels cover a larger range.
A simple way to see the phenomenon is to look at the histogram after a strong correction on an 8-bit image: it appears "combed," with columns separated by gaps. Each gap is a level that no longer exists.
Working at 16 bits
The solution during editing is to work at 16 bits per channel. Camera RAW files normally contain 12 or 14 bits of information per pixel; developing and retouching them at 16 bits preserves this richness and leaves room for corrections. Only at the end do you convert to 8 bits for delivery.
The cost is twice the memory and heavier files. For a photo to publish with light retouching, 8 bits may be enough; for an image destined for large-format printing or major editing, 16 bits is the prudent choice.
Floating point and HDR
8- or 16-bit integers represent values in a closed range, from black to white. For high dynamic range (HDR) images, 3D rendering and compositing, 16- or 32-bit floating-point numbers are used, which can represent values brighter than "white" with constant relative precision. Formats such as OpenEXR were created for this purpose. A sun reflection in a rendered scene may be worth dozens of times reference white: in floating point it stays that way and can be handled correctly later.
Dithering: useful noise
When bit depth has to be reduced, for example from 16 to 8, you can do better than rounding each value to the nearest level. Dithering adds a small amount of noise before quantisation. The result is that the boundary between two levels is no longer a sharp line but a zone of mixed pixels that the eye averages into a continuous transition.
The main techniques are:
- random dithering: low-intensity noise is added; simple and effective for photographic gradients;
- ordered dithering: a fixed matrix of thresholds is used (for example the Bayer matrix); it produces a recognisable regular pattern, typical of retro graphics;
- error diffusion: the rounding error of one pixel is distributed to neighbouring pixels not yet processed; the Floyd–Steinberg algorithm is the best known and is widely used to reduce images to limited palettes.
A small practical detail: dithering adds noise, and noise compresses poorly. A dithered image saved in a lossy format may weigh a little more; it is often an acceptable price for getting rid of banding.
Screens and the display chain
The path to the screen matters too. Many budget panels are truly 6-bit and simulate 8 bits with a temporal technique (FRC), rapidly alternating two levels. A 10-bit file shows its quality only if the application, operating system, graphics card, cable and monitor all support 10 bits. If one link in the chain works at 8 bits, the banding you see may come from the display rather than the file.
In short
- Banding depends on how many levels are available along a gradient, not on the total number of colors.
- 8 bits are enough for final display, but not for heavy editing or wide spaces.
- Retouch at 16 bits; for HDR and rendering use floating point.
- Dithering turns steps into fine noise that the eye perceives as continuous.
- Check the whole display chain before blaming the file for banding.