The Image Codec War
Currently there are four competing image formats: WebP, AVIF, HEIF and JPEG XL — Which will win?
WebP usage rose very fast because it was developed by Google based on VP8 and implemented into Chrome. Google claims that it’s 30% smaller at the same visual quality but in reality it is usually worse than JPEG at the same file size. It can only do 4:2:0 subsampling in a YUV colour space. WebP 2 is still unfinished. The attraction was most likely because it features animation and transparency while not being as large as a PNG.
AVIF is based on AV1 which is the successor of VP9 and already implemented into Chromium and Firefox. It too has drawbacks from being based on a video codec. Encoding takes multiple seconds which is extremely slow. However it is more appealing at very low file sizes then JPEG XL in my opinion because blur looks better than extreme DCT artifacts but DCT does convey more information. A thin line may be washed away in AVIF but still recognisable as such in JPEG XL. This resembles the WebP JPEG situation.
HEIF — based on HEVC like BPG — is only used by Apple. It compresses a lot better than JPEG but not as good as AVIF. Since it is based on HEVC, implementors have to pay royalty fees which means the format is as dead as JPEG 2000.
JPEG XL is the newest and completly royalty free. The bitstream was frozen on the 25. December 2020. The format consists of two parts. The lossy part derived from Google’s PIK format and the lossless part from FUIF / FLIF.
The lossy DCT encoding is an improvement of the old JPEG format. The compatibility means that old JPEG images can be transcoded to JPEG XL without any loss in quality and back. The quality even improves because of enhancements to the decoder which reduces the already existing artifects a tiny bit. This transformation reduces the size by 20% according to my own testing. Arithmetic encoding already did compress JPEGs further without loss but it had patent issues, so no decoder supported it. (You can try it in GIMP though.) Newly compressed images use the XYB colour space.
Lossless encoding has basically no competitors since the competition only offers near-lossless or very inefficient lossless encoding based on a lossy codec. PNG is over 25 years old, offers no progressive mode, colour spaces and bit depths were an after thought, so a PNG is either indexed, 8 or 16 bit per channel. A 10 bit image is thus saved as a 16 bit image which is anything but efficient. JPEG XL does all of it better.
Another feature is animations. GIF and APNG are thus finally obscolete.
Both Chromium and Firefox will implement JPEG XL which may or may not replace all image formats in the future depending on the momentum.
Hold off on AVIF, WebP and HEIF and continue using JPEG and PNG until support for JPEG XL comes along for all major applications.