Here we have more lossy tests of AVIF and WebP comparing to JPEG or PNG, but with the much smaller resolution and very close file size for testing the real-life usages. By using the <picture> tag, the priority is AVIF, WebP, and JPEG/PNG so all browsers can display.
<picture> <source srcset="photo.avif" type="image/avif"> <source srcset="photo.webp" type="image/webp"> <img src="photo.jpg" alt=""> </picture>
These tools make sure that the results would be fair and reliable.
- AVIF: Default (–min Q 1, –maxQ 10; added –minalpha Q 1, –maxalpha Q 10 for images without backgrounds)
- WebP: 92
- JPEG: 55
- PNG: 40
AVIF is the base for the file size because of its superiority. PNG is not lossy, but dithering should be more defined when the colours are further reduced below 256 for the much smaller file size.
Images with the alpha channel
AVIF images with even the default quality still look decent, but the file size is not large comparing to other image formats. WebP, however, is not very superior to MozJPEG because the results are significantly closer. For lossy images with the alpha channel, both of AVIF and WebP are better regarding to the quality and file size, as PNG is always lossless and JPEG does not support the alpha channel.
Some people said the quality of most of images on the internet are higher than what people need, but the reality is they look bad instead. The main reason is the outdated JPEG format, but lacking optimisation like MozJPEG (ImageOptim uses) results in larger files too. Before AVIF and WebP become more widespread, optimisation for JPEG and PNG remains very important for saving data traffic.