💾 Archived View for gem.billsmugs.com › gemlog › 2022-04-15-avif captured on 2023-11-14 at 07:54:04. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-07-16)
-=-=-=-=-=-=-
On Wednesday I received the 4th ever message via the contact link on my homepage (the 5th if you include the message consisting only of a single full-stop!) In it, someone asked what I thought about the AVIF image file format, specifically as a replacement for PNG/JPEG.
I'd not heard of this format before, so thank you for introducing it to me! I'm not an expert on file formats, so can't comment on the technical side, but I've had a bit of a play around and done some limited research, so here's my quick thoughts.
Be warned that this is my brief first impression, not in any way a rigorous scientific study! It's very possible that I've made several glaring mistakes or ignored important factors. All testing has taken place on a single PC and may not be representative of the average user.
If you're interested in the technical side of things, you can read about AVIF on Wikipedia:
Gemini mirror of the wiki page
The short version though is that it's a relatively new image format that aims to compete with both PNG and JPEG formats, providing smaller file sizes, support for transparency and animations, and the option of either lossless compression or lossy compression that preserves information much better than JPEG for the same file size.
Maybe. I've linked a JPEG and an AVIF copy of the same file below. I assume most Gemini clients can display JPEGs (either in the client itself or via an external viewer), but I suspect AVIF support is more limited.
Both files were created using the same ImageMagick command, operating on the original 100% quality 19.8MB 6000x3000 pixel JPEG output from Darktable:
convert -auto-orient original.jpg -resize 2000x2000 -quality 90 example.[jpg|avif]
Note that the AVIF file above is actually slightly bigger than the equivalent JPEG. I tested with a few other photos (a mix of colour and black and white and with/without areas of low/high detail) and typically AVIF did deliver on its promise of lower file sizes for visually indistinguishable results, but the above example shows it's not necessarily better in all cases. I could probably spend some time tweaking the quality level and get something smaller that looks the same (although dropping down to 70% started to noticeably reduce background detail), but is it worth it?
There's a good chance that you couldn't view the AVIF link above, despite almost certainly being able to see the JPEG one. Lagrange (my primary Gemini client) doesn't currently show AVIF files and it's not alone. While Chrome and Firefox both support it, it's not currently supported in Microsoft Edge or Safari (the default web browsers for millions of people!) I have a few image viewing applications on my desktop PC (running Linux) and they all managed, but with noticeable (multi-second) load times on large files, when the equivalent JPEG loaded instantly.
View support information for AVIF in tools, frameworks and operating systems here.
It's perhaps unfair to compare the performance of decades-old mass-adopted formats versus brand new challengers, but at present AVIF is at a massive disadvantage on that front. Converting a large image from JPG to AVIF took 17 seconds, with four CPU cores maxed out the whole time (about twice as long as converting to PNG, with higher average CPU load). Darktable supports AVIF as an export format, but I cancelled my attempts to use it after five minutes of waiting while it used 100% of a single CPU core and didn't appear to actually be achieving anything (JPEGs take a few seconds). My desktop has an Intel Core i7-4790K processor, running at somewhere between 4 and 4.4GHz (depending on load/temperature). It's not the top-of-the-line by any means but it's not exactly obsolete hardware! It's possible that more modern devices have better hardware support that nullify those differences, but I don't need to buy a new computer to load or process huge JPEG files, and the disk space saving is negligible by comparison.
Making a trade-off that favours file size over processing time is reasonable in many situations of course. As someone who rarely needs to download images without access to reasonably fast WiFi, personally I'd rather extend the battery life of mobile devices and reduce power consumption for mains-powered ones by sticking to older formats. I would imagine that many would make a similar choice, even in situations with very poor (e.g. satellite) Internet access, but that's well outside my personal experience, so I'm just speculating.
These points are solely on the basis of testing with photographs. I haven't investigated the stated support for transparency or animation. A good GIF replacement (with wider support than something like APNG) on its own could make a format worthwhile in my opinion, and modern websites use a lot of transparent PNG elements for navigation/headers etc, so if they can be made smaller with limited impact on processor time then that would be a plus too. I'm not writing off AVIF entirely as a format, but personally I'm going to keep using JPEG for my photos, at least for the immediately foreseeable future.
If you want to contact me (for any reason - it doesn't have to be related to this post or to anything technical), click the link below (or find it on the homepage of this capsule):
I can't guarantee I'll respond, (or give any kind of time-frame for doing so), but I will almost certainly read it within a day or so.