AVIF
AV1 Image File Format
A next-generation image format based on the AV1 video codec, offering superior compression.
Technical Detail
AVIF leverages the AV1 video codec's intra-frame compression for still images, achieving 30-50% smaller files than WebP and 50-70% smaller than JPEG at equivalent visual quality. It supports 8/10/12-bit color depth, HDR (PQ and HLG transfer functions), wide gamut, and alpha transparency. Encoding is significantly slower than JPEG or WebP, making it better suited for pre-processed assets than real-time generation. Browser support covers Chrome 85+, Firefox 93+, and Safari 16.4+.
Example
```javascript
// Image compression via Canvas
canvas.toBlob(
blob => console.log(`Size: ${(blob.size/1024).toFixed(0)} KB`),
'image/jpeg',
0.8 // quality: 0.0 (smallest) to 1.0 (best)
);
// WebP output (25-34% smaller than JPEG)
canvas.toBlob(cb, 'image/webp', 0.8);
```