What is anti-aliasing?

Anti-aliasing smooths the jagged, stair-stepped edges of shapes and text by giving edge pixels intermediate colors or opacity instead of making each pixel fully on or off.

By · Updated

Explained in more detail

A pixel grid cannot draw a diagonal or curved edge exactly. If each pixel is either fully the shape or fully the background, edges look like stairs. This stair-step effect is called aliasing.

Anti-aliasing fixes it by letting edge pixels be partly covered. A pixel that is about 40% inside the shape gets a color that is 40% shape and 60% background. On a solid background, that means a blended color. On a transparent background, it means the pixel keeps the shape's color but gets partial alpha, around 40% opacity. Viewed at normal size, the eye reads those in-between pixels as a smooth edge.

This has practical consequences for tools that work on pixels. In a transparent PNG, the soft edge pixels have low but non-zero alpha, so a trim tool needs a threshold to decide whether they count as content. In a color-keyed image, the edge pixels are blends of the subject and the old background, so they do not match the key color and survive removal, leaving a halo.

Scaling can also introduce or remove anti-aliasing. Enlarging a hard-edged image does not recover smooth edges, and shrinking an image averages neighbouring pixels, which smooths them. Canvas drawing has an imageSmoothingEnabled setting that controls whether scaled images are smoothed.

Fonts, vector renders and 3D graphics all use anti-aliasing. It is one of the reasons an exported logo has semi-transparent pixels along its outline.

Related terms

Try it in Triim

Sources

Part of the Triim image terms glossary, by Rocco Bombardieri.