Image file formats

October 16, 2018 — September 17, 2023

computers are awful
generative art
making things
photon choreography

Modern image formats, for my reference, with particular attention to the ones that are good for the web. Many guides to this, see e.g. avif.io. Notes here are for my purposes in particular.

Figure 1

Note that despite the apparently benign nature of tacking a representation of pixels from a file and putting it on a screen, image libraries have a long history of security bugs, including disastrous ones.

1 WebP

WebP image format is supported on most modern browsers. Notably, things that are not browsers are a bit crap at WebP, so chat programs and feed readers fail to create thumbnails of websites using WebP. Probably they will only support GIF89a until the end of time. That is why sometimes the page previews for this site look a bit crap; I use WebP quite a lot.

Famous WebP security vulnerability: CVE-2023-4863; tl;dr all software using WebP before 2023-09-14 was vulnerable to remote code execution.

2 AVIF

The most futuristic image format with reasonable support, i.e. 90%+ of browsers. It will even work in Microsoft Edge in the next version, supposedly. It was briefly going to be in Microsoft Edge, but they seem to have changed their minds. Like WebP, many non-browser apps are no good at AVIF, so some websites fail to render AVIF thumbnails; but that won’t stop me from using it. I’m not being paid to work around the deficiencies of other people’s software.

After much experimentation I am switching the etching and engraving artwork on this blog to AVIF; it looks much nicer and a much smaller file size.

3 JPEG2000

Never really got broad support.

4 JPEG XL

Maybe one day.

5 Even fringier options

bpg

Something in my heart yearns to develop AI image codecs.

6 Previewing in macOS

See macOS image preview.

7 Bonus: mass conversion

I like to convert my ultra-high-res TIFFs to still-very-large-but-manageable AVIFs with minimal loss of quality but a huge reduction (75%+?) in file size:

for file in *.tiff
    vips copy $file (string replace -r '\.tiff$' '.avif[Q=90,effort=9,lossless=false]' $file)
end