Java HEIC Writer
Java’s built-in ImageIO does not support writing HEIC files. JDeli is a 100% Java HEIC writer that provides full encoding control with no dependencies.
Getting started
Add JDeli to your project via Maven or Gradle, or see using JDeli with Java modules.
What is supported
The JDeli HEIC writer supports the following features:
| Feature | Support |
|---|---|
| Compression - Lossy | Yes |
| Compression - Lossless | No |
| YUV 4:2:0 | No |
| YUV 4:2:2 | No |
| YUV 4:4:4 | No |
| Alpha channels | Yes |
| HDR | No |
| Multiple images | Yes |
| Metadata | EXIF |
| ICC | No |
| Output to file | Yes |
| Output to OutputStream | Yes |
| Output to byte[] | Yes |
| Pure Java implementation | Yes |
Quick start or to replace in existing code using ImageIO:
The simplest way to write a HEIC image is:
JDeli.write(bufferedImage, "heic", file);
Or to a byte array:
byte[] heicData = JDeli.write(bufferedImage, "heic");
Or to an OutputStream:
JDeli.write(bufferedImage, "heic", os);
Simple usage
For better type safety, use OutputFormat:
JDeli.write(myBufferedImage, OutputFormat.HEIC, outputStreamOrFile);
OutputFormat allows setting of any supported Image Format
Benefits:
- Compile-time safety
- Cleaner code
- Recommended for new applications
Advanced usage: controlling the output
Use heicEncoderOptions when you need control over encoding behaviour.
final HeicEncoderOptions options = new HeicEncoderOptions();
//write out
JDeli.write(myBufferedImage, options, outputStreamOrFile);
HeicEncoderOptions allows setting of specific options.
Various image processing operations can be conducted on the image, detailed documentation can be found here.
Frequently asked questions
Can Java write or encode HEIC files without external libraries?
No. Java’s built-in ImageIO does not support writing or encoding HEIC files. JDeli provides a pure-Java HEIC encoder with no dependencies required.
Does writing or encoding HEIC in Java with JDeli require additional libraries?
No. JDeli is a 100% Java library with no dependencies. It runs on any platform where the JVM runs with no additional installation.
What output types does JDeli support for writing HEIC?
JDeli can write and encode HEIC to a File, OutputStream, or return the encoded data as a byte array.