Useful Tools for Creating AVIF Images | Style-Tricks

AVIF (AV1 Picture File Format) is a contemporary picture file format specification for storing photographs that supply a way more vital file discount when in comparison with different codecs like JPG, JPEG, PNG, and WebP. Model 1.0.0 of the AVIF specification was finalized in February 2019 and launched by Alliance for Open Media to the general public.

On this article, you’ll study some browser-based instruments and command line instruments for creating AVIF photographs.

Why use AVIF over JPGs, PNGS, WebP, and GIF?

  • Lossless compression and lossy compression
  • JPEG suffers from terrible banding
  • WebP is significantly better, however there’s nonetheless noticeable blockiness in comparison with the AVIF
  • A number of shade area
  • 8, 10, 12-bit shade depth


Jake Archibald, wrote an article a number of years again on this new picture format and in addition helped us to establish some disadvantages to compressing photographs, usually you need to look out for these two when compressing to AVIF:

  1. If a person appears on the picture within the context of the web page, and it strikes them as ugly on account of compression, then that stage of compression just isn’t acceptable. However, one tiny notch above that boundary is ok.
  2. It’s okay for the picture to lose noticeable element in comparison with the unique except that element is critical to the context of the picture.

See additionally: Addy Osmani at Smashing Magazine goes in-depth on using AVIF and WebP.

Browser Options


Screenshot of Squoosh.
Screenshot of Squoosh.

Squoosh is a well-liked picture compression internet app that means that you can convert photographs in quite a few codecs to different extensively used compressed codecs, together with AVIF.

  • File-size restrict: 4MB
  • Picture optimization settings (positioned on the best facet)
  • Obtain controls – this contains seeing the scale of of the ensuing file and the share discount from the unique picture
  • Free to make use of

Screenshot of
Screenshot of is a picture software that doesn’t require any type of code. All it’s worthwhile to do is add your chosen photographs in PNG, JPG, GIF, and so forth. and it could return compressed variations of them.

  • Conversion settings (positioned on the top-right of add banner)
  • Free to make use of

You could find solutions to your questions on the FAQ page.

Command Line Options


avif-cli by lovell helps you to take AVIF photographs saved in a folder and converts them to AVIF photographs of your specified discount measurement.

Listed here are the necessities and what it’s worthwhile to do:

Set up the bundle:

npm set up avif

Run the command in your terminal:

npx avif --input="./imgs/*" --output="./output/" --verbose
  • ./imgs/* – represents the placement of all of your picture information
  • ./output/ – represents the placement of your output folder

  • Free to make use of
  • Pace of conversion might be set

You could find out about extra instructions by way of the avif-cli GitHub page.


sharp (additionally maintained by lovell) is one other useful gizmo for changing massive photographs in widespread codecs to smaller, web-friendly AVIF photographs.

Listed here are the necessities and what it’s worthwhile to do:

Set up the bundle:

npm set up sharp

Create a JavaScript file named sharp-example.js and duplicate this code:

const sharp = require('sharp')

const convertToAVIF = () => {
    .toFormat('avif', {palette: true})
    .toFile(__dirname + 'path_to_output_image')


The place path_to_image represents the trail to your picture with its identify and extension, i.e.:


And path_to_output_image represents the trail you need your picture to be saved with its identify and new extension, i.e.:


Run the command in your terminal:

node sharp-example.js

And there! It is best to have a compressed AVIF file in your output location!

  • Free to make use of
  • Photographs might be rotated, blurred, resized, cropped, scaled, and extra utilizing sharp

See additionally: Stanley Ulili’s article on How To Process Images in Node.js With Sharp.


AVIF is a expertise that front-end builders ought to contemplate for his or her tasks. These instruments let you convert your current JPEG and PNG photographs to AVIF format. However as with adopting any new software in your workflow, the advantages and disadvantages will must be correctly evaluated in accordance along with your explicit use case.

I hope you loved studying this text as a lot as I loved writing it. Thanks a lot to your time and I hope you might have an amazing day forward!

Add a Comment

Your email address will not be published. Required fields are marked *