AVIF libraries
Open-source libraries that decode and encode AVIF files. Almost all of them wrap the same C code: libavif or libheif for the container, dav1d or libaom to decode AV1, and libaom, SVT-AV1 or rav1e to encode. Which codecs your build has decides what works: a library built with only dav1d can read AVIF but not write it.
| Language | Library | Read | Write | Notes |
|---|---|---|---|---|
| C/C++ | libavif | yes | yes | reference library, every AVIF feature, animation |
| C/C++ | libheif | yes | yes | HEIF container library: AVIF, HEIC and more; LGPL |
| C/C++ | heicdec | yes | no | plain-C AVIF + HEIC decoder, AV1 through dav1d; AGPL |
| C# | Magick.NET | yes | yes | ImageMagick for .NET, 100+ formats |
| C# | NetVips | yes | yes | libvips binding, fast, low memory |
| Go | gen2brain/avif | yes | yes | libavif in WebAssembly, no cgo; animation |
| Python | Pillow | yes | yes | built in since Pillow 11.3 wheels; 8-bit only |
| Python | pyvips | yes | yes | libvips binding; 10/12-bit, large images |
| Ruby | ruby-vips | yes | yes | libvips binding |
| Rust | ravif | no | yes | pure Rust encoder (rav1e) |
| Rust | image | yes | yes | encodes with ravif; decoding needs dav1d |
| PHP | GD | yes | yes | bundled with PHP 8.1+ (if built with libavif) |
| PHP | Imagick | yes | yes | ImageMagick extension, via libheif |
There is no maintained open-source AVIF library for Java: call libavif through JNI or Panama, run avifenc/avifdec as a process, or convert on a server with libvips.
By language#
- AVIF libraries for C/C++ Open-source C/C++ libraries for AVIF images: libavif, libheif and heicdec, plus the AV1 codecs dav1d, libaom, SVT-AV1 and rav1e. Comparison.
- AVIF libraries for C# Open-source .NET libraries to read and write AVIF images: Magick.NET and NetVips. Comparison and C# code examples.
- AVIF libraries for Go Open-source Go libraries to read and write AVIF images: gen2brain/avif, which runs libavif without cgo. Code examples for decoding, encoding and animated AVIF.
- AVIF libraries for Python Open-source Python libraries to read and write AVIF images: Pillow and pyvips. Comparison and Python code examples.
- AVIF libraries for Ruby Open-source Ruby libraries to read and write AVIF images: ruby-vips, the libvips binding. Code examples for converting, thumbnails and quality settings.
- AVIF libraries for Rust Open-source Rust crates to read and write AVIF images: ravif, a pure Rust encoder, and the image crate. Comparison and Rust code examples.
- AVIF libraries for PHP Open-source PHP extensions to read and write AVIF images: GD (imageavif, PHP 8.1+) and Imagick. Comparison and PHP code examples.