Why gradients band, and what to do about it
The stripes across a smooth ramp are not a rendering mistake. They are the arithmetic of eight bits meeting a frame that is wider than the number of values eight bits can hold.
256 levels, and a frame that needs more
A channel in an ordinary image file holds one byte, which is 256 possible values. A ramp from a dark tone to a light one does not use all of them — it uses the span between its two ends. A ramp covering half the range has about 128 levels to work with.
Spread those 128 levels across 1920 pixels and each one has to be held for fifteen pixels before the next is allowed. Fifteen pixels of identical colour with a hard step at the end of it is a stripe, and the eye is extraordinarily good at finding stripes: lateral inhibition in the retina exaggerates exactly this kind of edge, which is why a step of one 255th is visible at all.
| Ramp runs across | Pixels per level | Visible? |
|---|---|---|
| 400 px | 3 | rarely |
| 1080 px | 8 | on a flat area |
| 1920 px | 15 | usually |
| 3840 px | 30 | always |