Skip to content
Create more with Morphed(opens in a new tab)

Paid AI

Optimization

JPEG vs WebP vs AVIF vs PNG: A Reproducible Compression Benchmark

Four original test images (photo-like, logo, transparent graphic, text screenshot) encoded at fixed settings, with file sizes, PSNR, SSIM, magnified crops and a script that regenerates every number.

Author
ImageWand Team
Published
Reading time
9 min read
Sources checked
November 24, 2026

morphed.app · Paid AI tools

Put this guide to work in a fresh creative project.

Reading "JPEG vs WebP vs AVIF vs PNG: A Reproducible Compression Benchmark"?

Explore AI photo editing in Morphed (opens in a new tab)

Paid AI tools. Separate account and upload in Morphed.

A watercolor portrait surrounded by flowers

A portrait with a painterly feel

Soft watercolor, delicate flowers, a pale backdrop.

AI-created concept image. Results vary.

See an example

Smaller file, same pixel dimensions

A measured JPEG quality example. Set the quality or target size for your own image in the compressor.

Original-quality landscape JPEG

Higher quality

640 x 360 px - 117.2 KB

Compressed landscape JPEG

Compressed copy

640 x 360 px - 34.7 KB

Format guides, including ours, often say things like “WebP is smaller than JPEG”. This page is our evidence: four original test images, encoded with real codecs at fixed settings, measured with objective metrics, and published with the script that produces every number so anyone can check it.

The test images

All four images were drawn by a script for this benchmark, so they can be published and redistributed without licence questions. They are synthetic, not photographs. Each was designed to stress compression in a different way.

ImageSizeWhat it testsDownload
Photo-like landscape960 × 640Gradients, texture, sensor-style grain, one hard-edged buildingsource-photo.png
Flat logo640 × 480Three flat colours, crisp anti-aliased edges, bitmap textsource-logo.png
Transparent graphic640 × 480Product cutout, soft shadow, a 45%-opacity tag, transparent backgroundsource-transparent.png
Text screenshot960 × 6401–2 px text and 1 px coloured lines on a light backgroundsource-text.png

Settings and versions

Encoding used sharp 0.34.5 (libvips 8.17.3) with these libraries: mozjpeg 0826579 for JPEG, libwebp 1.6.0, libheif 1.20.2 with aom 3.13.1 for AVIF, libspng 0.7.4 / libpng 1.6.50 and libimagequant 2.4.1 for PNG.

  • JPEG: quality 60, 75 and 90; sharp defaults otherwise (4:2:0 chroma subsampling, mozjpeg trellis and scan optimisations off).
  • WebP lossy: quality 60, 75 and 90; default effort 4. Lossy WebP always uses 4:2:0 chroma.
  • AVIF: quality 45, 60 and 75; sharp defaults (effort 4, 4:4:4 chroma).
  • WebP lossless, PNG at compression level 9, and PNG 256 colours (palette quantised with libimagequant).
  • The transparent graphic was flattened on white for JPEG, which has no transparency.

Quality numbers mean different things in each codec, so compare formats by size and score, not by the quality setting.

Metrics. PSNR is measured over the red, green and blue channels; higher is closer, and identical images have no PSNR. SSIM (structural similarity) is computed on brightness with the standard 11 × 11 Gaussian window; 1 means identical. For the transparent graphic, both images are flattened on white before scoring, and transparency is scored separately. The metrics are implemented in the published script rather than taken from a library.

Results: photo-like landscape

SettingBytesBits per pixelPSNR (dB)SSIM
JPEG q6030,5990.39836.250.8948
JPEG q7547,9620.62537.110.9078
JPEG q90107,4681.39938.790.9346
WebP q6014,9100.19436.330.8774
WebP q7520,3840.26536.830.8854
WebP q9097,1041.26439.830.9545
AVIF q456,7980.08937.310.8770
AVIF q6013,4760.17538.250.8912
AVIF q7546,7230.60839.830.9273
WebP lossless540,7767.041identical1 (identical)
PNG (lossless)746,6129.722identical1 (identical)
PNG 256 colours281,5543.66644.470.9871
Five magnified crops of the red building: source, JPEG q75, WebP q75, AVIF q60 and PNG 256 colours. The lossy versions smooth away the fine grain.
Photo-like image, 120 × 90 px crop at 2× magnification. Synthetic test image.

At about the same SSIM, AVIF q60 (13,476 bytes, 0.8912) was less than half the size of JPEG q60 (30,599 bytes, 0.8948), and WebP q75 (20,384 bytes, 0.8854) sat between them. Lossless formats were 11 to 16 times larger than JPEG q75: exact copies of a noisy photo are expensive. The SSIM scores of the lossy files are lower than you would see on most real photos because the per-pixel grain we added is exactly what lossy codecs discard.

SettingBytesBits per pixelPSNR (dB)SSIM
JPEG q608,7910.22936.790.9950
JPEG q7510,6110.27638.470.9969
JPEG q9015,0110.39140.820.9988
WebP q604,0380.10539.770.9986
WebP q754,4560.11640.300.9989
WebP q906,9420.18141.510.9996
AVIF q451,9690.05143.800.9991
AVIF q602,7230.07148.630.9997
AVIF q753,4570.09052.180.9998
WebP lossless3,9160.102identical1 (identical)
PNG (lossless)9,2560.241identical1 (identical)
PNG 256 colours4,3160.11276.001.0000
Magnified crops of the orange ring and dark bar of the logo in five versions. At this magnification they look almost the same.
Flat logo, 120 × 90 px crop at 2× magnification. Synthetic test image.

For flat graphics, an exact copy was cheap: lossless WebP (3,916 bytes) was smaller than every JPEG and every lossy WebP, and less than half the size of PNG (9,256 bytes). JPEG was the worst choice here: the largest lossy files and the lowest scores. At normal size the difference is hard to see, but every JPEG was larger than the exact lossless WebP.

Results: transparent graphic

SettingBytesBits per pixelPSNR (dB)SSIMTransparency
JPEG q607,2500.18938.900.9964removed, flattened on white
JPEG q758,6420.22540.390.9976removed, flattened on white
JPEG q9012,5580.32742.890.9989removed, flattened on white
WebP q605,3620.14044.970.9983kept exactly
WebP q755,5820.14544.200.9978kept exactly
WebP q906,8660.17946.930.9992kept exactly
AVIF q452,9190.07647.330.9981kept, alpha PSNR 49.49 dB
AVIF q603,7920.09951.490.9991kept, alpha PSNR 54.54 dB
AVIF q754,5840.11954.060.9994kept, alpha PSNR 58.15 dB
WebP lossless4,5540.119identical1 (identical)kept exactly
PNG (lossless)7,7050.201identical1 (identical)kept exactly
PNG 256 colours4,4730.11660.510.9998kept, alpha PSNR 61.32 dB
Magnified crops of the soft shadow and translucent tag over a checkerboard. The JPEG crop has a solid white background instead of transparency.
Transparent graphic over a checkerboard, 120 × 90 px crop at 2× magnification. JPEG cannot keep transparency, so its background is white. Synthetic test image.

Lossy WebP kept the transparency channel exactly (libwebp stores it losslessly by default) and was smaller than PNG. AVIF compresses transparency too, so its alpha is close but not exact. JPEG had to be flattened on white: fine on a white page, wrong anywhere else. See what flattening does to a PNG.

Results: text screenshot

SettingBytesBits per pixelPSNR (dB)SSIM
JPEG q6042,4370.55332.270.9865
JPEG q7550,6650.66033.990.9912
JPEG q9070,1270.91335.520.9969
WebP q6015,0000.19535.110.9988
WebP q7516,1980.21135.480.9988
WebP q9025,3980.33136.190.9996
AVIF q455,6990.07442.940.9997
AVIF q609,0750.11851.021.0000
AVIF q759,4860.12452.311.0000
WebP lossless3,0660.040identical1 (identical)
PNG (lossless)8,0530.105identical1 (identical)
PNG 256 colours5,2940.069identical1 (identical)
Magnified crops of orange pixel text and the top of an orange button in five versions.
Text screenshot, 120 × 90 px crop at 2× magnification. Synthetic test image.

This is where format choice mattered most. The exact lossless WebP was 3,066 bytes; JPEG at quality 90 was 70,127 bytes, about 23 times larger, and still not exact. JPEG and lossy WebP store colour at half resolution (4:2:0), which blurs thin coloured text; AVIF here kept full colour resolution (4:4:4), one reason it scored so much higher. For screenshots and diagrams, use PNG or lossless WebP.

What this means in practice

  • Photos: WebP or AVIF make much smaller files than JPEG at similar quality. JPEG is still the safest choice for places that accept only JPEG.
  • Logos, icons and flat graphics: use lossless WebP or PNG. Lossy formats add artefacts and are not smaller.
  • Transparent images: WebP keeps exact transparency and was smaller than PNG here. Never use JPEG unless you want a solid background.
  • Text and screenshots: lossless WebP or PNG. JPEG was the worst option on every measure.

To try these on your own files: the converter writes JPEG, PNG and WebP (WebP not in Safari), and AVIF only where your browser can encode it; the compressor writes JPEG, WebP or PNG. Our format guide explains where each format is supported.

Limitations

  • Synthetic images. They were built to be reproducible and redistributable, not to represent all photos. Real photos usually have less per-pixel noise and will score higher at the same settings.
  • One encoder per format. These are libvips encoders. ImageWand’s browser tools use your browser’s own encoders, which make different byte counts at the same quality setting; the ranking of formats is what carries over, not exact sizes.
  • Fixed settings. We did not tune effort, chroma subsampling or other advanced options. Slower settings can make every lossy format smaller.
  • Two metrics. PSNR and SSIM are objective but imperfect stand-ins for what people see. Look at the crops, and compare your own images at 100% zoom.

Reproduce it

Run node scripts/benchmark/run.mjs in the ImageWand repository. It draws the four sources (scripts/benchmark/lib/synthetic.mjs), encodes them, decodes every output again, computes the metrics (scripts/benchmark/lib/metrics.mjs) and writes results.json, the sources and the crops. No timestamps are recorded, so with the same sharp and libvips versions the output is identical byte for byte; the repository’s content tests check that.

Sources

Platform rules change. These are the official pages this guide was checked against on . Always confirm the current rule before you submit.

  1. sharp: Output options (jpeg, webp, avif, png) · sharp documentation · accessed
  2. The SSIM Index for Image Quality Assessment (Wang, Bovik, Sheikh and Simoncelli, IEEE Transactions on Image Processing 13(4), 2004) · Laboratory for Computational Vision, New York University · accessed
  3. Image file type and format guide · MDN Web Docs · accessed

Frequently asked questions

Which image format makes the smallest files?

In this benchmark AVIF made the smallest lossy files for all four images, and lossless WebP made the smallest exact copies of the logo, transparent graphic and text. JPEG was the largest lossy format on the text screenshot by a wide margin. Results depend on the image and settings.

Can ImageWand save AVIF?

Only in browsers whose canvas can encode AVIF. In our tests on 24 November 2026, Safari's WebKit engine could and Chrome could not, so the converter offers AVIF only when your browser can actually write it.

Can I rerun this benchmark?

Yes. Run node scripts/benchmark/run.mjs in the ImageWand repository. With the same sharp and libvips versions it rewrites results.json byte for byte.

Written by

ImageWand Team · Editorial Team

The ImageWand editorial team writes practical guides on image editing, file formats, compression, and platform-specific image requirements. Each guide lists the official sources we checked and when, and says plainly which steps ImageWand can and cannot do. About ImageWand