Alpha channel 2026-11-05
An alpha channel stores an additional value for each pixel that controls its contribution when images are combined by alpha compositing. In a common normalized convention, makes the source pixel fully transparent and makes it fully opaque. An alpha channel can describe partial coverage as well as transparency; its meaning includes the compositing rule, rather than merely a fourth color component. PNG represents its explicit alpha channel with 8-bit or 16-bit values, with zero fully transparent and the maximum value fully opaque.[ref]
For source color and an opaque background color , the source-over rule in Linear-light RGB is
For an original example, a red source at over a blue background produces . These are linear color components; applying the same arithmetic directly to nonlinear display codes generally gives a different physical mixture.[ref]
Storage conventions matter too. With straight alpha the stored color remains ; with premultiplied alpha it is . The red source in the example is therefore stored as either or . Using the first formula on an already premultiplied color would multiply its source contribution by alpha twice. PNG explicitly uses non-premultiplied color samples.[ref]
Premultiplied alpha 2026-11-05
With premultiplied alpha, a stored colour triple already includes its alpha channel multiplier: , where is the corresponding straight alpha colour. The alpha value itself is retained. This is also called associated alpha. For , recover ; at zero alpha the multiplication loses the original colour. PNG uses unassociated samples rather than this convention.[ref]
For an original Linear-light RGB example, red with becomes the stored quadruple . The source-over compositing contribution of this sample is already . Multiplying its first three entries by alpha again would make the red contribution instead of .
Premultiplied alpha also makes a useful linear interpolation example transparent. Let sample A be opaque red, , and sample B be fully transparent blue, . Their premultiplied quadruples are and . Averaging them gives
Placed over black, this contributes . Averaging the straight colour triples and alphas separately would instead give , , contributing over black. That blue contribution came from colour attached to a fully transparent sample. The calculation explains how an interpolation convention can create a coloured fringe.
The multiplication convention and the color space are separate choices. The example uses Linear-light RGB throughout. A file decoder, texture sampler and alpha compositing stage must agree on both the colour encoding and whether the samples use straight alpha or premultiplied alpha.