Straight alpha 2026-11-05
With straight alpha, colour samples are stored independently of their alpha channel value. The same convention is called unassociated alpha. For a normalized colour triple and alpha , the stored pair is ; premultiplied alpha instead stores . The PNG specification requires the unassociated convention.[ref]
Portable Network Graphics (PNG) Specification (Third Edition) by Mark Adler and others. §6.2, Alpha representation
For an original Linear-light RGB colour and alpha , the straight-alpha quadruple is . The corresponding premultiplied quadruple is . Both describe the same source contribution when interpreted correctly. Raising alpha to can leave the straight colour triple unchanged, while its premultiplied counterpart must become .
For source-over compositing against an opaque black background, the first sample contributes . The stored straight colour is therefore not already its final contribution. At zero alpha, a straight-alpha representation can retain arbitrary colour components while the source contributes no colour to this operation. Multiplying by zero discards those components.
Unpremultiplication recovers the straight colour by dividing premultiplied colour by alpha when alpha is nonzero. It cannot recover a colour erased at zero alpha, and finite-precision errors become significant near zero. If a premultiplied component has absolute rounding error at most , exact division by a fixed alpha magnifies that bound to . At , a component error can therefore become . These are original error bounds, rather than a measured decoder defect.
The alpha convention and the color space remain separate specifications. For light-linear arithmetic, decode nonlinear colour samples before forming their light contributions. PNG documents both compositing and conversion from associated data, including handling zero alpha.[ref]
Portable Network Graphics (PNG) Specification (Third Edition) by Mark Adler and others. §12.3, conversion from associated data; §13.16, alpha channel processing