Krunkit

Optimize AVIF

Re-encode AVIF images with fine-tuned compression. Already small files, made even smaller.

Drop images here or click to browse (up to 10)

JPEG, PNG, WebP, AVIF up to 50MB each

AVIF Optimization Guide

Fine-Tuning

Adjust quality to find the optimal balance for your specific image content.

Quality 70-80

Sweet spot for web images — excellent quality with tiny file sizes.

Quality 50-60

For thumbnails and previews where file size is the priority.

Already Optimal?

AVIF is already highly efficient. Savings may be modest but still valuable.

libavif Optimization: Extracting Maximum Efficiency from the Most Advanced Image Codec

AVIF optimization through Krunkit uses libavif, the reference encoder maintained by the Alliance for Open Media. The encoder exposes a speed parameter from 0 (slowest, most efficient) to 10 (fastest, least efficient). Each speed step adjusts dozens of internal parameters including transform block sizes, RDO (rate-distortion optimization) aggressiveness, and intra-prediction mode evaluation depth. Moving from speed 6 (Krunkit's default) to speed 4 typically reduces file size by 8-15% at the cost of 3-5x longer encoding time.

AVIF's tile-based encoding offers optimization opportunities unique to this format. Large images can be divided into independent tiles that encode and decode in parallel. For a 4000x3000 image, encoding with 2x2 tiles enables multi-threaded WASM processing and reduces the browser's peak memory usage from ~180 MB to ~50 MB. However, tile boundaries introduce redundancy because prediction cannot cross tiles — using fewer tiles produces smaller files when memory is not a constraint.

Chroma subsampling provides significant optimization potential in AVIF. The default 4:2:0 subsampling reduces color resolution to one-quarter of luminance resolution, which is imperceptible in most photographs because the human visual system is far less sensitive to color detail than brightness detail. However, for content with saturated color edges — red text on blue backgrounds, color calibration targets, fashion photography with vivid fabrics — switching to 4:4:4 subsampling preserves color fidelity at a 15-25% file size increase.

AVIF uniquely supports film grain synthesis, a technique borrowed from AV1 video encoding. Instead of compressing grainy textures pixel by pixel, the encoder analyzes the grain pattern, encodes a smooth underlying image, and stores grain parameters that the decoder uses to regenerate synthetic grain during display. For photographs shot at high ISO or images with intentional film grain aesthetic, this feature reduces file size by 20-40% while maintaining the visual texture that gives the image its character.

Pro Tips

  • Drop encoder speed to 4 for images on your landing page and product pages

    Speed 4 instead of the default speed 6 produces AVIF files 8-15% smaller. For your 5-10 most important images that every visitor sees, the extra encoding time (10-20 seconds per image) is a one-time cost that pays off across every subsequent page load. Use speed 6 for bulk content.

  • Keep 4:2:0 subsampling unless your image has vivid color edges

    Chroma 4:2:0 is visually transparent for photographs, landscapes, and portraits — the human eye cannot detect the reduced color resolution. Switch to 4:4:4 only for images where color precision at sharp edges matters: logos, product flat-lays with bright colors, or color-graded editorial photography.

  • Enable film grain synthesis for editorial and documentary photography

    If your photographs were shot at ISO 1600+ or have intentional grain for aesthetic effect, enable grain synthesis to let the encoder parameterize the grain pattern. This can reduce file size by 20-40% while the decoded image looks indistinguishable from the original to viewers — the grain is regenerated mathematically during decoding.

  • Compare AVIF optimization against full re-encoding from source

    If you have the original uncompressed source file, encoding directly from source at a lower speed setting will produce smaller AVIF files than re-optimizing an already-encoded AVIF. When possible, keep your original TIFF or PNG masters and encode to AVIF as the final step in your image pipeline.

Frequently Asked Questions

Can AVIF files be optimized further?

Re-encoding with adjusted quality settings can reduce size. The savings depend on the original encoding settings.

Is AVIF optimization lossy?

Yes, re-encoding AVIF is lossy. Use quality 80+ to minimize visible impact.

When should I optimize AVIF?

When you need to squeeze out every byte — for bandwidth-sensitive applications, slow connections, or large image galleries.

How long does it take?

A few seconds per image. AVIF encoding is computation-intensive but our WebAssembly codec handles it efficiently.