#avif #convert #av1 #png2avif #jpeg2avif

app cavif

Encodes images in AVIF format (image2avif converter). Pure Rust.

9 releases (1 stable)

1.0.0 Mar 24, 2021
0.6.6 Jan 29, 2021
0.6.2 Sep 14, 2020
0.5.1 Sep 9, 2020
0.1.0 Aug 26, 2020

#68 in Images

Download history 7/week @ 2020-12-22 2/week @ 2020-12-29 28/week @ 2021-01-05 37/week @ 2021-01-12 10/week @ 2021-01-19 31/week @ 2021-01-26 7/week @ 2021-02-02 17/week @ 2021-02-09 65/week @ 2021-02-16 21/week @ 2021-02-23 11/week @ 2021-03-02 20/week @ 2021-03-09 17/week @ 2021-03-16 70/week @ 2021-03-23 18/week @ 2021-03-30 20/week @ 2021-04-06

91 downloads per month


552 lines

cavif — PNG/JPEG to AVIF converter

Encoder/converter for AVIF images. Based on rav1e and avif-serialize, which makes it a pure Rust tool, with no C code!


➡️ Download the latest release ⬅️

The pre-built zip includes a portable static executable, with no dependencies, that runs on any Linux distro. It also includes executables for macOS and Windows.


  • Chrome 85 desktop and libavif: full support. Support for --premultiplied-alpha option is coming soon.
  • Chrome on Android 12: full support.
  • Firefox 86: not compatible with images with alpha channel yet.


Run in a terminal (hint: you don't need to type the path, terminals accept file drag'n'drop)

cavif image.png

It makes image.avif. You can adjust quality (it's in 1-100 scale):

cavif --quality 60 image.png


You can also specify multiple images (encoding is multi-threaded, so the more, the better!).

  • --quality=n — Quality from 1 (worst) to 100 (best), the default value is 80. The numbers have different meaning than JPEG's quality scale. Beware when comparing codecs. There is no lossless compression support.
  • --speed=n — Encoding speed between 1 (best, but slowest) and 10 (fastest, but a blurry mess), the default value is 1. Encoding of AVIF is pretty slow, so you need either a) beefy multicore machine b) avoid large images c) patience.
  • --overwrite — Replace files if there's .avif already. By default existing files are left untouched.
  • -o path — Write output to this path instead of samefile.avif. If multiple input files are specified, it's interpreted as a directory.
  • --quiet — Don't print anything during conversion.
  • --premultiplied-alpha — May improve compression of transparent images by lowering quality of semi-transparent colors. Warning: new feature, may not be compatible with all decoders yet.
  • --dirty-alpha — Don't change RGB values of transparent pixels. By default irrelevant color of transparent pixels is cleared to avoid wasting space.
  • --color=rgb — encode using RGB color space instead of YCbCr color space. Makes color closer to lossless, but makes files larger.


To build it from source you need:

  • Rust 1.48 or later, preferably via rustup
  • nasm 2.14 or later

Then run in a terminal:

cargo install cavif


~252K SLoC