Should I use avif or jpegxl for mass archival of photos?

I was trying to decide whether to archive all my photos as raw(lossless), png (lossless), webp(lossless), webp(lossy), avif(lossless), avif(lossy), jpgxl(lossless),jpgxl(lossy).

Considering all my factors (3 TB of Raw Images needed to be cloud saved), I decided to go for jpgxl(lossy) and store the data at 16% of original size - 480 GB at almost indistinguishable visual quality.

These findings might help you decide.

Result

JPEG XL is about 30 percent better overall and gives similar visual fidelity. (This is as per my personal analysis and factors and not claiming to be perfect.)

Commands - Shell and Windows Command Line

avifenc.exe -q 75 1.jpg 4-75.avif
cjxl -q 75 1.jpg 2_75.jxl --lossless_jpeg=0

Where are the encoders?

AVIF Encoder Link

JPGXL Encoder Link

Results data

Sl Type File Size (MB) Format Quality (Q) Visual quality Score Saved Filesize MB Saved Filesize Percent
1 Reference 25.3 Jpg 100 100 0 0
2 Lossless 27.7 AVIF 100 100 -2.4 -9.5
3 Lossless 21.3 JXL 100 100 4 15.8
4 Quality at 75 6.3 AVIF 75 99 19 75.1
5 Quality at 75 3.06 JXL 75 99 22.24 87.9
6 Quality at 50 3.05 AVIF 50 98 22.25 87.9
7 Quality at 50 1.93 JXL 50 98 23.37 92.4
8 Quality at 25 1.19 AVIF 25 97 24.11 95.3
9 Quality at 25 1.39 JXL 25 97 23.91 94.5

JPEG XL

JPEG XL is a royalty-free raster-graphics file format that supports both lossy and lossless compression. It is designed to outperform existing raster formats and thus become their universal replacement

The JPEG XL call for proposals talks about the requirement of a next generation image compression standard with substantially better compression efficiency (60% improvement) comparing to JPEG. The standard is expected to outperform the still image compression performance shown by HEIC, AVIF, WebP, and JPEG 2000. It also provides efficient lossless recompression options for images in the traditional/legacy JPEG format.

JPEG XL supports lossy compression and lossless compression of ultra-high-resolution images (up to 1 terapixel), up to 32 bits per component, up to 4099 components (including alpha transparency), animated images, and embedded previews. It has features aimed at web delivery such as advanced progressive decoding[13] and minimal header overhead, as well as features aimed at image editing and digital printing, such as support for multiple layers, CMYK, and spot colors. It is specifically designed to seamlessly handle wide color gamut color spaces with high dynamic range such as Rec. 2100 with the PQ or HLG transfer function.

AVIF

AV1 Image File Format (AVIF) is an open, royalty-free image file format specification for storing images or image sequences compressed with AV1 in the HEIF container format. It competes with HEIC, which uses the same container format built upon ISOBMFF, but HEVC for compression. Version 1.0.0 of the AVIF specification was finalized in February 2019.

In a number of tests by Netflix in 2020, AVIF showed better compression efficiency than JPEG as well as better detail preservation, fewer blocking artifacts and less color bleeding around hard edges in composites of natural images, text, and graphics.

Image Samples

Samples