I want to transcode the image files for a website to modern file formats, and did some testing with AVIF, WebP, and JPEG XL using the following settings for the respective encoders:
cjxl -e 9 -q 80 --lossless_jpeg=0
cwebp -q 80 -m 6
avifenc -s 0 -q 80 --qalpha 80
When transcoding photographic images, cjxl
produced the smallest files (cwebp
in second place, and avifenc
coming last):
-rw-r--r--@ 1 snafu staff 1.4M Oct 26 15:04 photo_large.avif
-rw-r--r--@ 1 snafu staff 7.7M Oct 26 12:26 photo_large.jpeg
-rw-r--r--@ 1 snafu staff 950K Oct 26 15:03 photo_large.jxl
-rw-r--r--@ 1 snafu staff 1.0M Oct 26 15:03 photo_large.webp
With screenshots (usually containing some windows/file listings and other UI elements), the order is reversed:
-rw-r--r--@ 1 snafu staff 139K Oct 26 11:46 screenshot_large.avif
-rw-r--r--@ 1 snafu staff 384K Oct 26 11:55 screenshot_large.jxl
-rw-r--r--@ 1 snafu staff 1.4M Oct 26 11:32 screenshot_large.png
-rw-r--r--@ 1 snafu staff 247K Oct 26 11:39 screenshot_large.webp
I was under the impression that both AVIF and JPEG XL were designed to supersede older formats for all types of images, so I would expect them both to produce smaller files than WebP with a fixed quality, and I do not understand why AVIF and JPEG XL excel at different image types.
I am grateful for any hint regarding comparable settings and an explanation for the surprising (at least for me) strengths/weaknesses of AVIF and JPEG XL.