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 sometime 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 an switching the etching and engraving artwork on this blog to AVIF; it looks much nicer and a much smaller filesize.

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 filesize:

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