Converting images to AVIF in 2024

 Wed, 01 May 2024 19:06 UTC

Converting images to AVIF in 2024
Image: CC BY 4.0 by cybrkyd


AVIF is now widely supported on all modern browsers.1 Whilst the resulting image quality is subjective in comparison to similar next-gen image compression like WEBP, I have found that AVIF is a worthy alternative and far superior. In my experience, AVIF compressed images appear to be more ‘true’ to the original when comparing them to WEBP. The colours appear less ‘washed out’ for starters. But, as mentioned above, this is purely subjective.

There are few online web apps which can convert images to the AVIF format. The one that I keep returning to is Squoosh. It allows for fine-tuning the output image via the advanced settings menu and the results are pretty decent.

I’ve played around with GIMP to export images to AVIF and, whilst the output file size is incredibly tiny, I have noticed the colour wash-out on certain images. GIMP makes use of libheif but the lack of options available when exporting makes this a problem, particularly when it comes to fine-tuning the image.2

Converting a single image with Krita

One of the methods I have used to convert PNGs and JPEGs to AVIF is Krita. Like Gimp, Krita uses libheif and it also has a very basic export-to-AVIF dialogue but at least it offers the option to change the chroma subsampling (which impacts colour wash-out).3 The chroma options in Krita are: 4:2:0, 4:2:2 and 4:4:4, with the 4:4:4 ratio turning off the chroma subsampling. Yes, the file size is larger in comparison to GIMP but this is how I was able to get an AVIF export which appears very close to the source image.

It must be noted that results very much depend on the image itself. Where images have a lot of ‘info’ or ‘detail’, the difference between chroma subsampling or not will be obvious to the eye.

Converting a single image with avifenc

My go-to method for AVIF conversion is avifenc, which makes use of libavif,4 the official AVIF implementation.5 This command line tool has a vast collection of parameters for more granular control over the final image. To make use of avifenc, install libavif-bin from your repository:

Debian-based distributions:

$ sudo apt install libavif-bin 

Red Hat-based distributions:

$ sudo yum -y install libavif 

To convert a PNG to AVIF using the basic, default options, state your input and output images:

$ avifenc input.png output.avif

For more information on avifenc, check the help files:

$ avifenc -h

Converting multiple images with avifenc

To convert multiple images in the same folder to AVIF format, run:

$ for i in *.png; do avifenc -s 2 $i -o "${i%.*}.avif"; done

File size and quality

  • avifenc exports images without chroma subsampling (default is 4:4:4) and even then, the file size of the AVIF image is comparable to the size output by GIMP.
  • All my tests on converting images with avifenc have resulted in small file sizes; much smaller than those output by Krita.
  • The quality is on par with the exports from Krita but when size becomes an issue, avifenc wins hands down.
  • The output from avifenc mimics the results from Squoosh, both in terms of size and quality.

In conclusion, Krita works perfectly well for a quick export where quality matters but size doesn’t. avifenc is my preference as it is capable of a quality conversion in the smallest possible size.


  1. Browser support: caniuse.com - AVIF image format ↩︎

  2. GIMP News: GIMP 2.10.2 Released ↩︎

  3. Krita 5.0 Release Notes: Krita 5.0 Release Notes ↩︎

  4. libavif on GitHub: libavif ↩︎

  5. Alliance for Open Media: AVIF Specification and Source Code ↩︎