A quick and dirty test regarding which lossless picture compression format should I use for Web or Archiving.

During testing, Gimp PNG is used as a baseline, and the following commands were used to try and achieve better compression:

#PNG (Optimized)
zopflipng -y -m <IN> <OUT>

#JPEG XL (Lossless)
cjxl --num_threads=8 -v -q 100 -e 9 --brotli_effort=11 <IN> <OUT>

#WebP (Lossless)
convert <IN> -define webp:lossless=true -define webp:method=6 <OUT>

#AVIF (Lossless)
avifenc --jobs 8 --lossless --speed 0 --codec aom <IN> <OUT>

Picture

A picture of a few objects on a table, an RNG I made some time ago. This picture is something PNG nor any lossless picture format should not be that good at.

A random number generator I made...

Results

Format Time Size Ratio
PNG (Gimp) 1s 476K 100.0%
PNG (Zopfli) 21s 463K 97.3%
AVIF (aom) 18s 402K 84.5%
WebP 1s 361K 75.8%
JPEG XL 25s 324K 68.1%

Screenshot

A Windows XP dialog screenshot, large areas of the same color. Something PNG is good at, as should any lossless format.

A windows XP screenshot

Results

Format Time Size Ratio
PNG (Gimp) 1s 6.4K 100.0%
AVIF (aom) 11s 11.9K 187.2%
PNG (Zopfli) 19s 5.5K 85.7%
WebP 0s 4.9K 76.9%
JPEG XL 2s 3.6K 55.1%

Conclusion

WebP for web, JPEG XL for archiving. AVIF is a clear loser for lossless compression being not the best when improving on PNG, too slow, and sometimes having significantly worse compression than even un optimized PNG.