What is an Alpha Channel?

An alpha channel stores per-pixel transparency separately from an image’s color channels. Its values represent fully transparent, fully opaque, or partially transparent coverage.

How Alpha Channels work

An alpha value records how opaque a pixel is. In PNG, zero means fully transparent and the maximum sample value means fully opaque; values in between mark partial coverage, as along a soft edge. A compositor blends each foreground pixel with whatever lies behind it in proportion to alpha. The color beside alpha can be stored in two ways. Straight alpha, also called non-premultiplied or unassociated, keeps the full color next to its alpha value. Premultiplied, or associated, alpha stores color already multiplied by alpha, which shortens the compositing formula. In the HTML Standard’s example, half-transparent yellow is 255, 255, 0, 127 as straight alpha and 127, 127, 0, 127 as premultiplied. PNG files store straight alpha, HTML canvas 2D output bitmaps use premultiplied alpha, and TIFF can hold either with a tag that says which. Software has to know which form it is reading, and converting between the two is lossy for pixels that are not fully opaque.

Key facts

  1. What goes wrong when straight and premultiplied alpha are mixed up? Soft edges change color. Premultiplied data composited as straight has its color multiplied by alpha a second time, so partially transparent edges turn dark. Straight data treated as premultiplied is added at full strength, so edges look too bright. Fully opaque pixels are identical in both forms, which is why the error appears as a fringe around cutouts and not in solid areas. Tools that accept both expose a setting: FFmpeg’s overlay filter, for example, has an alpha option with the values straight, premultiplied, and auto.
  2. Why does a cutout get a halo after resizing? With straight alpha, a fully transparent pixel still stores a color, and a filter that averages each channel separately blends that hidden color into neighboring edge pixels. The usual remedy is to premultiply, resize, and then convert back. Not every tool does this for you: libvips documents that its resize operation does not premultiply alpha and tells callers to do it first.
  3. Which still-image formats keep alpha? PNG stores a full alpha channel in its truecolor-with-alpha and greyscale-with-alpha types; otherwise it can give each palette entry its own alpha value or mark a single color as fully transparent. WebP can store alpha in both lossless and lossy files; lossy needs the extended file layout. GIF has no alpha channel: one palette index can be marked transparent, so each pixel is either drawn or skipped. JPEG has no alpha channel, and converters differ in what replaces transparency. Some composite the image onto a background color. Others only drop the alpha channel, which leaves whatever color the transparent pixels stored: ImageMagick’s documentation describes its JPEG output as equivalent to -alpha off, with transparent backgrounds commonly becoming black. For a predictable result, composite onto a background you choose before encoding. Defaults for that step differ too: sharp’s flatten, for example, defaults to black.
  4. Does a video file’s extension show whether it has alpha? No. Alpha depends on the codec and its profile. Among Apple ProRes codecs, only ProRes 4444 and ProRes 4444 XQ support an alpha channel, so two files with the same extension can differ. VP8 and VP9 can carry alpha, but MDN notes that Safari does not support alpha transparency in either. The encoder may also need to be told to write it: FFmpeg’s prores_ks encoder has an alpha_bits option whose value 0 disables the alpha plane.

When Alpha Channels matter

Preserve alpha when compositing logos, cutouts, overlays, or transparent animation onto other content. A codec or format without alpha support will discard transparency or require a chosen background.

How Transloadit helps with Alpha Channels

Transloadit’s /image/resize Robot changes the background of transparent images to white by default; its documentation says to set background to none to preserve transparency. The output format still has to be one that can store alpha. The Robot’s alpha parameter controls the channel directly, and requesting has_transparency through output_meta reports whether an image contains transparent parts, which helps when choosing an output format per file. The /image/bgremove Robot removes backgrounds and writes PNG by default.

These two pages do not say whether resizing uses straight or premultiplied alpha. If edge quality matters, resize a cutout with soft edges, place it over a contrasting background, and inspect the result before processing a whole collection.

Explore Transloadit’s image capabilities

Sources

Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

Try Transloadit for free