kornelski / cavif-rs

AVIF image creator in pure Rust
https://lib.rs/cavif
BSD 3-Clause "New" or "Revised" License
570 stars 27 forks source link
avif avif-encoder image-converter rust

cavif — PNG/JPEG to AVIF converter

Encoder/converter for AVIF images. Based on rav1e and avif-serialize, which makes it an almost pure-Rust tool (it uses C LCMS2 for color profiles).

Installation

➡️ 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.

Usage

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

Advanced usage

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

cavif [OPTIONS] IMAGES...

There are additional options that tweak AVIF color space. The defaults in cavif are chosen to be the best, so use these options only when you know it's necessary:

Compatibility

Images work in all modern browsers.

Known incompatibilities

Building

To build it from source you need Rust 1.67 or later, preferably via rustup.

Then run in a terminal:

rustup update
cargo install cavif