Image Compression Benchmarks 2024 - JPEG, WebP, AVIF Measured Comparison
Benchmark Methodology - Conditions for Fair Comparison
Image compression format comparisons produce meaningless results without proper methodology. Claims like "AVIF is 50% smaller than JPEG" vary dramatically based on quality settings and image content. This benchmark establishes fair comparison conditions.
Comparison basis: Equal visual quality - We adjust each format's quality parameter (JPEG quality, WebP quality, AVIF CRF) to achieve identical SSIM (Structural Similarity Index) scores. Using SSIM 0.95 as the baseline, we compare the minimum file size each format requires to achieve this quality level.
Test image set: 5 categories × 20 images each = 100 total images. (1) Photographs (landscapes, portraits, food), (2) Illustrations/graphics (flat design, gradients), (3) Screenshots (text-heavy, UI), (4) Transparent images (product photos, icons), (5) High-frequency images (textures, fine patterns).
Encoders: JPEG uses libjpeg-turbo 3.0, WebP uses libwebp 1.3.2, AVIF uses libavif 1.0.4 (aom encoder). All are the latest stable versions as of 2024.
Encoding settings: JPEG - quality 60-95 range searching for SSIM 0.95. WebP - quality 50-90 range. AVIF - CRF 20-45 range, Speed 6. Binary search determines optimal quality per image, targeting SSIM 0.950±0.002. This methodology objectively answers: "at the same perceived quality, which format produces the smallest file?"
Photography Category Results - AVIF's Dominant Advantage
Photographs (natural images) are the category where image compression formats perform best. Continuous tones and gradients allow frequency-transform-based compression to function effectively.
Results summary (SSIM 0.95 baseline, median of 20 images):
- JPEG (libjpeg-turbo): Baseline 100% (achieved at quality 78-82)
- WebP (libwebp): 68% of JPEG (32% reduction, achieved at quality 72-76)
- AVIF (aom): 48% of JPEG (52% reduction, achieved at CRF 28-32)
AVIF achieves equivalent visual quality at less than half the file size of JPEG. WebP is 30%+ smaller than JPEG but the gap with AVIF is clear.
Resolution-dependent trends: AVIF's advantage increases with higher resolution. At 4000px width, AVIF compresses to 45% of JPEG, while 400px thumbnails only reach 55%. This is because AVIF's block size (up to 64x64) functions more efficiently with larger images.
Content-dependent trends: Landscape photos (sky gradients, distant detail) show AVIF's strongest performance at 42% of JPEG. Textured close-ups (fabric, wood grain) show reduced advantage at 55% of JPEG. Portraits achieve 47% of JPEG, with AVIF's prediction model effectively handling skin gradients.
Encoding time comparison: JPEG 1x (baseline), WebP 3-5x, AVIF 15-25x (Speed 6). AVIF's encoding time is a clear disadvantage, but acceptable for build-time batch processing where the compression savings justify the computational cost.
Illustration and Screenshot Category Results
Illustrations and screenshots have different characteristics from photographs. Sharp edges, uniform color areas, and text create content with mixed high-frequency and low-frequency components.
Illustrations/Graphics (SSIM 0.95 baseline, median of 20 images):
- JPEG: Baseline 100% (achieved at quality 85-90; high quality needed to suppress edge ringing)
- WebP: 55% of JPEG (45% reduction)
- AVIF: 38% of JPEG (62% reduction)
AVIF's advantage expands further in the illustration category. JPEG produces visible block boundary artifacts requiring high quality settings to achieve SSIM 0.95. AVIF's larger block sizes and advanced prediction models compress uniform color areas with extreme efficiency.
Screenshots (SSIM 0.95 baseline, median of 20 images):
- JPEG: Baseline 100% (achieved at quality 88-92)
- WebP: 42% of JPEG (58% reduction)
- AVIF: 30% of JPEG (70% reduction)
Screenshots are AVIF's strongest category. It maintains text sharpness while compressing uniform background areas to their theoretical minimum. The 70% reduction versus JPEG is remarkable.
Important note: When lossless compression is required for illustrations or screenshots, PNG remains the most compatible choice. WebP lossless is 26% smaller than PNG, and AVIF lossless is 10-15% smaller still, but considering browser support rates, PNG + WebP fallback remains the safe approach for maximum compatibility.
Transparent and High-Frequency Image Results
Images with transparency (alpha channels) and high-frequency content (textures) require particular attention in format selection.
Transparent images (SSIM 0.95 baseline, including alpha, median of 20 images):
- PNG (lossless): Baseline 100%
- WebP (lossy + alpha): 18% of PNG (82% reduction)
- AVIF (lossy + alpha): 12% of PNG (88% reduction)
The migration effect from PNG is dramatic for transparent images. E-commerce product photos (white background made transparent) typically see 500KB PNGs become 90KB in WebP and 60KB in AVIF. A page with 100 product images reduces from 50MB to 6MB (AVIF) - transformative for page load performance.
High-frequency images (textures, fine patterns, SSIM 0.95 baseline):
- JPEG: Baseline 100% (achieved at quality 82-88)
- WebP: 75% of JPEG (25% reduction)
- AVIF: 58% of JPEG (42% reduction)
High-frequency images are "difficult" for all formats. Fine patterns and textures resist prediction, reducing compression efficiency. AVIF still achieves 42% reduction versus JPEG - less dramatic than other categories but clearly advantageous.
Notable finding: When AVIF quality is pushed too low (CRF 40+) on high-frequency images, "smearing" occurs - detail loss from overly aggressive deblocking filters. For texture photography, limit CRF to 25-30. WebP doesn't exhibit this issue as severely, making it preferable for texture preservation in some scenarios.
Encoding Speed and Decoding Speed Comparison
Beyond file size, encoding and decoding speed are critical format selection factors. Real-time conversion requirements and client-side decode performance directly impact user experience.
Encoding speed (1200x800px photo, equal quality baseline):
- JPEG (libjpeg-turbo): 15ms (baseline 1x)
- WebP (libwebp, method 4): 65ms (4.3x)
- AVIF (aom, speed 6): 280ms (18.7x)
- AVIF (aom, speed 4): 850ms (56.7x)
- AVIF (aom, speed 8): 120ms (8x, but 10-15% compression ratio loss)
AVIF encoding takes nearly 20x longer than JPEG. Processing 1,000 images: JPEG takes 15 seconds, AVIF (speed 6) takes approximately 5 minutes. Acceptable for CI/CD pipelines but unsuitable for real-time conversion on user upload.
Decoding speed (browser rendering):
- JPEG: 8ms (baseline 1x)
- WebP: 10ms (1.25x)
- AVIF: 18ms (2.25x)
AVIF decoding takes approximately 2x longer than JPEG. The 10ms per-image difference is negligible individually, but pages with 50+ images may see cumulative impact. Using decoding="async" minimizes main thread impact.
Memory usage: Peak memory during AVIF decoding is approximately 1.5x that of JPEG. On memory-constrained mobile devices (budget Android phones), simultaneously decoding many AVIF images may cause memory pressure. Consider lazy loading strategies to limit concurrent decode operations on resource-constrained devices.
Image compression technical books are well-stocked on Amazon
Format Selection Guidelines Based on Benchmark Results
Based on measured data, here are format selection guidelines by image type and use case.
Recommended format selection matrix:
- Photos (web delivery): AVIF as primary, WebP as fallback, JPEG as final fallback. Build a 3-tier fallback chain with the picture element.
- Illustrations/graphics (lossy acceptable): AVIF is most efficient. Flat designs with uniform color areas can expect 60%+ reduction versus JPEG.
- Screenshots: AVIF is overwhelmingly advantageous (70% reduction vs JPEG). Maintains text sharpness while maximizing compression.
- Transparent images: WebP or AVIF. Migration from PNG yields 80-88% size reduction. E-commerce product images should be highest priority.
- Textures/high-frequency: AVIF (CRF limited to 25-30) or WebP. Watch for AVIF smearing at aggressive compression levels.
- Animation: WebP animation or MP4. AVIF animation browser support remains insufficient for production use.
Cost-benefit judgment: Considering AVIF adoption costs (build pipeline changes, increased encoding time, fallback management), migrate in this priority order: (1) Transparent images (PNG → WebP/AVIF for maximum reduction), (2) Hero/LCP images (direct LCP improvement), (3) All photographs (large cumulative effect from volume), (4) Illustrations/screenshots (lower priority if WebP already sufficient).
Final decisions should be based on your site's image composition and user browser distribution. If AVIF support exceeds 90% of your user base, comprehensive AVIF migration is fully justified by the bandwidth and performance gains demonstrated in these benchmarks.