1

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.

1 Answer 1

1

The problem is in the images themselves.

Formats were originally designed for different image formats.

JPEG XL is good at compressing images with lots of detail and smooth gradients while maintaining quality.

AVIF does a better job with images that have sharp lines and simple shapes (e.g. text and interface elements).

There are two solutions to choose from.

The first. You create an additional variable that is responsible for the image type.

The second. Just experiment with the -q parameter until you find the golden mean.

2
  • 1
    Thanks – this is what my test seems to show, but I have not been able to find any source describing the different use cases of JPEG XL and AVIF. All reviews/comparisons point out that they are both all-purpose formats.
    – janeden
    Commented Oct 26 at 20:22
  • universal, yes, but the result will depend on the original image. and still, in general, webp wins a significant share so far. Commented Oct 26 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.