What AVIF is, and why programs cannot open it
AVIF is an image format built on AV1, a video codec developed in the open and free to use. caniuse describes it as generally compressing better than WebP, JPEG, PNG and GIF, and MDN says lossy AVIF files are around 50 percent smaller than JPEG ones. MDN adds that it can hold transparency, 8, 10 or 12 bits per colour, HDR and animation.
It arrived recently. Browsers got it in these versions: Chrome 85, Firefox 93, Safari 16.4 and Edge 121, with Opera 71 and Samsung Internet 14 as well. caniuse counts about 96 percent of browser use worldwide as full support. Outside browsers the picture is different. Photo editors, document programs, print services, email clients and many upload forms were written years before AVIF and do not read it. That is where a JPG helps.
You often meet AVIF without choosing it. Websites and social platforms serve AVIF to browsers that accept it, and "save image as" then gives you an .avif file.
What you lose going to JPG
- Transparency. AVIF can hold an alpha channel, and JPG cannot. The converter fills transparent areas with your background colour. Choose a dark colour for light artwork, or it will vanish on white. If you need transparency, use AVIF to PNG.
- Bit depth and colour range. A JPG holds 8 bits per colour. A 10 bit or HDR AVIF is reduced to that, and the extra brightness range of HDR cannot be kept. We converted a 10 bit file, and the picture decoded to within two levels of a reference decoder's 8 bit output. Colours are converted to sRGB: a Display P3 AVIF came out 0.16 of a level from a LittleCMS conversion on average, where unconverted numbers would have been 3.3 levels off.
- Animation. An AVIF sequence, which is how animated AVIF is stored, gives its first frame. We tested a three frame file and got the first.
- Metadata. The JPG carries no camera details or location, and no colour profile.
The JPG will be bigger
AVIF compresses better than JPG, so turning it into a JPG makes a larger file. We measured three test pictures at quality 90. A 2048 by 1536 photo of 344 KB as an AVIF became 551 KB, which is 60 percent more. A 10 bit version of it went from 375 KB to 565 KB (51 percent more), and a 1024 pixel square picture with transparency went from 35 KB to 47 KB (33 percent more).
If the JPG is only needed for one upload, that does not matter. If you are converting a whole gallery to save space, lower the quality, or consider keeping AVIF for browsers and making JPG only for the places that need it. The list shows every size next to the original.
Quality for a second compression
AVIF is lossy, and so is JPG, so this conversion compresses the picture a second time. Doing it once from your best AVIF is fine. Repeating it, or converting the JPG to AVIF and back, adds loss each time.
Quality 90 suits most photos. For pictures with thin coloured lines or small text, use 95 or more: from 95 the encoder keeps colour at full resolution rather than half, which keeps coloured edges cleaner, at the price of a bigger file. Lower numbers give smaller files and more visible compression damage.