TL;DR
Java’s ImageIO does not support AVIF output. To add AVIF support to ImageIO, you can use the Open source vavi-image-avif plugin (which is a wrapper around libavif) or the commercial JDeli library (which is a pure Java Implementation).
Does Java support AVIF natively?
No. ImageIO ships without an AVIF codec, so both reads and writes fail silently or throw an exception:
// Both of these fail with vanilla ImageIO
// Read
BufferedImage image = ImageIO.read(new File("input.avif")); // returns null
// Write
ImageIO.write(bufferedImage, "avif", new File("output.avif")); // returns false
You need an external library. The two main options are vavi-image-avif (free, open source) and JDeli (commercial).
JDeli vs vavi-image-avif: which should you use?
| JDeli | vavi-image-avif | |
|---|---|---|
| Pure Java (no native binaries) | ✓ | ✗ (wraps native libs) |
| Works as ImageIO plugin | ✓ | ✓ |
| Direct API (non-ImageIO) | ✓ | ✗ |
| Encoder options (quality, speed) | ✓ | Limited |
| Supports other formats (WebP, HEIC, TIFF…) | ✓ | ✗ |
| Cost | Commercial | Free |
| Support | Included | GitHub issues |
| Actively developed | ✓ | Limited |
vavi-image-avif is a reasonable choice for a simple, low-stakes use case. If you are running a server, distributing an application, or need format breadth beyond AVIF, JDeli is the safer option.
Option 1: Add AVIF support to ImageIO (no code changes)
JDeli registers itself as an ImageIO plugin, so your existing read/write calls work without modification once it is on the classpath.
Maven
<dependency>
<groupId>com.idrsolutions</groupId>
<artifactId>jdeli</artifactId>
<version>[JDELI_VERSION]</version>
</dependency>
Gradle
implementation 'com.idrsolutions:jdeli:[JDELI_VERSION]'
Alternatively, download the trial jar and add it to your classpath manually.
Once JDeli is on the classpath, your existing ImageIO code works unchanged:
// Read — works once JDeli is on the classpath
BufferedImage bufferedImage = ImageIO.read(new File("input.avif"));
// Write — same
ImageIO.write(bufferedImage, "avif", new File("output.avif"));
Option 2: Write AVIF directly with the JDeli API
The JDeli API gives you more control and does not depend on ImageIO’s plugin registration order.
- Add JDeli to your class or module path. (download the trial jar)
- Create a
FileorOutputStreamfor the output. - Call
JDeli.write()with your image, format, and output target.
// String format
JDeli.write(bufferedImage, "avif", new File("/path/to/output.avif"));
// Type-safe enum (preferred)
JDeli.write(bufferedImage, OutputFormat.AVIF, new File("/path/to/output.avif"));
Controlling output with AVIFEncoderOptions
For production use you will usually want explicit control over compression. Pass an AVIFEncoderOptions object instead:
AVIFEncoderOptions options = new AVIFEncoderOptions();
options.setQuality(80); // 0–100, higher = better quality, larger file
JDeli.write(bufferedImage, options, new File("/path/to/output.avif"));
See the AVIFEncoderOptions API reference for the full list of settings.
Frequently asked questions
What is the AVIF format?
AVIF (AV1 Image File Format) is an image format derived from the AV1 video codec. It offers better compression than JPEG and WebP at equivalent visual quality, with typical file sizes 50% smaller than JPEG. It supports HDR, wide colour gamut, and transparency, making it increasingly common for web images.
Which browsers support AVIF?
AVIF has broad browser support, covering Chrome, Firefox, Safari 16+, and Edge. See caniuse.com/avif for current data.
Can I read AVIF files in Java with JDeli?
Yes. See our companion article: how to read AVIF files in Java.
Is JDeli pure Java?
Yes. JDeli has no native binaries and makes no calls to external libraries. This matters in server or distributed environments where deploying platform-specific binaries is impractical or a security concern.
Other useful AVIF resources
As experienced Java developers, we help you work with images in Java and bring over a decade of hands-on experience with many image file formats.
Are you a Java Developer working with Image files?
// Read an image
BufferedImage bufferedImage = JDeli.read(avifImageFile);
// Write an image
JDeli.write(bufferedImage, "avif", outputStreamOrFile);// Read an image
BufferedImage bufferedImage = JDeli.read(dicomImageFile);// Read an image
BufferedImage bufferedImage = JDeli.read(heicImageFile);
// Write an image
JDeli.write(bufferedImage, "heic", outputStreamOrFile);// Read an image
BufferedImage bufferedImage = JDeli.read(jpegImageFile);
// Write an image
JDeli.write(bufferedImage, "jpeg", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(jpeg2000ImageFile);
// Write an image
JDeli.write(bufferedImage, "jpx", outputStreamOrFile);
// Write an image
JDeli.write(bufferedImage, "pdf", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(pngImageFile);
// Write an image
JDeli.write(bufferedImage, "png", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(tiffImageFile);
// Write an image
JDeli.write(bufferedImage, "tiff", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(webpImageFile);
// Write an image
JDeli.write(bufferedImage, "webp", outputStreamOrFile);
What is JDeli?
JDeli is a commercial Java Image library that is used to read, write, convert, manipulate and process many different image formats.
Why use JDeli?
To handle many well known formats such as JPEG, PNG, TIFF as well as newer formats like AVIF, HEIC and JPEG XL in java with no calls to any external system or third party library.
What licenses are available?
We have 3 licenses available:
Server for on premises and cloud servers, Distribution for use in a named end user applications, and Custom for more demanding requirements.
How does JDeli compare?
We work hard to make sure JDeli performance is better than or similar to other java image libraries. Check out our benchmarks to see just how well JDeli performs.