AVIF Pixel Art Compression Without Edge Blur

AVIF can effectively compress synthetic pixel art without introducing edge blur, but only when configured in a true lossless mode with full color sampling. By default, AVIF relies on lossy video compression techniques that smooth hard boundaries and introduce color bleeding around sharp, high-contrast pixels. This article examines why standard lossy AVIF blurs pixel art, how lossless AVIF prevents it, and whether AVIF is the right tool compared to traditional formats like PNG.

Why Standard Lossy AVIF Blurs Pixel Art

AVIF is derived from the AV1 video codec, an architecture engineered primarily for continuous-tone photographic images and natural video. It relies on frequency-domain transformations, such as the Discrete Cosine Transform (DCT), to discard high-frequency data that human vision typically overlooks in photographs.

Pixel art is the opposite of a photograph. It consists almost entirely of high-frequency data: razor-sharp boundaries, intentional hard edges, and single-pixel color shifts. When lossy AVIF processes these structures, several artifacts occur:

Under standard lossy settings, AVIF consistently degrades the sharp grid of pixel art.

How to Prevent Edge Blur in AVIF

To eliminate edge blur completely, AVIF must be encoded using strict parameters that bypass its lossy photographic optimizations:

  1. Enable True Lossless Mode: The encoder must be set to transform-bypass lossless mode (e.g., crf=0 or --lossless). This disables lossy quantization and preserves exact spatial values.
  2. Use 4:4:4 Chroma or RGB: Chrominance downsampling must be disabled. Using full YUV 4:4:4 or native RGB color spaces ensures color boundaries remain aligned with pixel boundaries.
  3. Disable In-Loop Restoration Filters: Deblocking and directional enhancement filters must be turned off to prevent post-process smoothing.

When these settings are applied, AVIF guarantees mathematical preservation of every pixel, eliminating edge blur entirely.

Compression Efficiency: AVIF vs. PNG and WebP

While AVIF can preserve pixel art losslessly, it is rarely the most efficient format for doing so.

Synthetic pixel art typically features limited color palettes, large areas of flat color, and repeating geometric tiles. Formats like PNG (using DEFLATE) and lossless WebP (using LZ77 and spatial transformation models) are purpose-built for this exact profile:

Summary

AVIF avoids edge blur on synthetic pixel art only when encoded losslessly with 4:4:4 chroma sampling. However, because its compression engine is designed for complex visual gradients rather than indexed, hard-edged graphics, using lossless AVIF for pixel art usually results in larger file sizes and slower rendering speeds than optimized PNG or lossless WebP.