The command line tool avifenc provided by libavif is limited. It can only encode AVIF files from supplied PNG, JPEG and raw YUV data files, with no support for HEIC or WebP files.
This library uses libavif to encode AVIF files, but provides an interface for encoding AVIF files from a wider range of source formats. Currently supported input formats:
- PNG (using
libspng) - JPEG (using
libjpeg-turbo) - HEIC (using
libheif) - WebP (using
libwebp)
Just like avifenc, avifconvert handles EXIF and XMP metadata properly.
Alongside avifconvert, this project also provides a avifconvertwatch tool that can be used to watch a directory for new files and convert them to AVIF format automatically. This is useful for integrating into workflows where images are added to a directory. I use it on my NAS along with PhotoSync on my phone to convert incoming images after upload.
In addition, JNI binding are provided, but they are untested.
This is not a drop-in replacement for avifenc, nor is it a very mature project. Many things won't work. Use at your discretion.
Pre-built binaries are available for download on the releases page for the following platforms:
- Linux (x86_64 and arm64)
- Windows (x86_64)
Otherwise, you can build from source as described below.
This project uses cmake and vcpkg, as well as Java for JNI bindings. Ensure cmake and Java are installed on your system before building. The dependencies for the project are described in vcpkg.json.
Run this after cloning to fetch and initialise the vcpkg submodule:
git submodule update --init --recursive
vcpkg/bootstrap-vcpkg.sh # or vcpkg/bootstrap-vcpkg.bat on windowsConfigure and build with cmake:
cmake --preset Release && cmake --build --preset ReleaseThe resulting binaries will be found in a build-release/ or build-release/Release/ folder depending on your cmake toolchain.
./avifconvert my-image.webpThis will create a file called my-image.avif in the same directory.
Options:
-dor--delete-originalwill delete the original file, replacing it with the AVIF file.-vor--versionwith no other arguments will print the version of the tool.
./avifconvertwatch /path/to/my/dirThis will run continuously, watching for new convertible files in that directory, or subdirectories up to one level deep, converting to AVIF and deleting the original file. Options:
-vor--versionwith no other arguments will print the version of the tool.
- Support Y4M files, like the original
avifenc - Support GIF files, including animated GIFs.
- Support BMP files
- Support TIFF files
- Support JPEG XL files
- Support
avifconvertwatchwith unlimited nested subdirectories, currently it only watches one subdirectory deep. - Get static linking working on all platforms
- Add tests