ClickForArt

Color Banding

Color banding is a smooth gradient breaking into stripes. Why 8-bit color runs out of steps, why your eye sharpens the edges, and how a little noise hides it.

What is color banding?

Color banding is the stepped look of a gradient that should be smooth, where a sunset sky, a vignette or a dark wall breaks into distinct stripes of slightly different color. It happens when an image has too few color levels for a gradual change, so whole runs of neighboring pixels round to the same value and then jump together to the next one.

When the effect is deliberate or extreme it is usually called posterization. Video people often call it contouring.

Why does banding happen?

Most images store 8 bits per channel, which gives 256 levels each of red, green and blue. A gradient seldom uses the whole range, though. A dark sky that runs from a value of 20 to 50 across a frame 1920 pixels wide has only 30 levels to spend, so each band ends up about 64 pixels wide, easily wide enough to see.

Compression makes it worse. Video codecs save bits by flattening areas that change slowly, which is why dark scenes on streaming services often show rings around a lamp or a fade to black that steps instead of glides. Ten-bit video, used for HDR, has 1,024 levels per channel, so each step is a quarter of the size.

Why do the bands look sharper than they are?

Your visual system boosts contrast at edges. In 1865 the physicist Ernst Mach described how a step in brightness seems to carry a light stripe on its bright side and a dark stripe on its dark side, although nothing of the kind is in the light itself. These Mach bands are why a one-level jump, which you could never pick out between two separate swatches, turns into a visible line inside a gradient.

Smooth, low-contrast areas show banding most, because they have no texture to distract the eye from those edges. Skies, studio backdrops and out-of-focus backgrounds are the usual victims.

How do you fix color banding?

Add noise before the colors get rounded. A little random variation makes each pixel round up or down unpredictably, so the hard edge between two levels dissolves into a fine mix that the eye averages back into a smooth ramp. This is dithering, and 3D renderers often add a faint noise to every frame for exactly this reason.

The other fix is more levels. Edit in 16 bits, render gradients at a high bit depth, and reduce to 8 bits only at the very end, with dithering on. Blurring an already banded 8-bit image won't help, because there are no in-between values for the blur to use between two neighboring levels.

Hiding banding with grain

Film Grain Overlay is the quickest cover. On a banded sky, start from the Fine preset, which sets Amount to 0.12, and raise Amount until the stripes stop reading as lines. Turn RGB off for mono grain so the noise doesn't sprinkle colored specks over a flat blue. Save a PNG, since a heavily compressed JPG or video can smooth the grain away and bring the bands right back. For a deliberate retro look, Dither Image goes the other way and lets a visible pattern stand in for the missing shades.

Try it

Further reading