Java HEIC Library — Read, Write & Convert HEIC Files
Read, write, convert, and process HEIC images in pure Java. No native code. Drop-in ImageIO replacement. Commercial license with dedicated support.
JDeli is a commercial, pure-Java image library that reads, writes, and converts HEIC files with no native code or third-party dependencies. It works as a drop-in ImageIO replacement. Add one JAR and your existing image code can handle the format Java cannot open on its own.
Quick Start
Add the dependency, write one line, read or convert any HEIC file. Java's ImageIO has no HEIC support, so this is the part that does not work without a library.
// Add IDR Solutions repository to your pom.xml
<repositories>
<repository>
<id>IDRsolutions</id>
<name>IDR Solutions</name>
<url>https://maven.idrsolutions.com</url>
</repository>
</repositories>
// Add JDeli as a dependency
<dependencies>
<dependency>
<groupId>com.idrsolutions</groupId>
<artifactId>jdeli</artifactId>
<version>{YYYY.MM}</version>
</dependency>
</dependencies>// Add IDR Solutions repository to your build.gradle
repositories {
maven {
url = "https://maven.idrsolutions.com"
name = "IDRsolutions"
credentials(PasswordCredentials)
}
}
// Add JDeli as a dependency
dependencies {
implementation "com.idrsolutions:jdeli:{version}"
}HEIC Code Examples for Java
Copy-paste solutions to the exact problems Java developers search for: read HEIC to a BufferedImage, convert HEIC to JPG, write HEIC, and batch convert from the command line.
# Batch convert every HEIC file in a directory to JPG.
# Works from bash, bat, or PowerShell, and lets you call JDeli from any language that can spawn a child process.
java -jar jdeli.jar --convert jpg "inputDir" "outputDir"// Convert to and from HEIC files
JDeli.convert(File inFile, File outFile);
JDeli.convert(InputStream inStream, OutputStream outStream, String format);
byte[] outputData=JDeli.convert(byte[] inputData, String format);// Convert HEIC to JPG
JDeli.convert(new File("input.heic"), new File("output.jpg"));
JDeli.convert(heicStream, jpgStream, "jpg");
byte[] jpgData = JDeli.convert(heicData, "jpg");// EXIF metadata is copied across automatically on convert.
// Camera fields, capture date, and orientation are preserved.
JDeli.convert(new File("photo.heic"), new File("photo.jpg"));// Read HEIC files
JDeli.read(File HeicFile);
JDeli.read(byte[] HeicData);
JDeli.read(InputStream HeicStream);// Write HEIC files
// To a File
JDeli.write(myBufferedImage, "heic", new File("output.heic"));
// To an OutputStream
JDeli.write(myBufferedImage, "heic", outputStream);
// To a byte array (returns the encoded bytes)
byte[] heicData = JDeli.write(myBufferedImage, "heic");Java HEIC Library Comparison
An honest comparison of the realistic ways to handle HEIC in a Java application.
| Feature | JDeli | libheif binding (JNI) |
|---|---|---|
| HEIC read | ✅ Yes | ✅ Yes |
| HEIC write | ✅ Yes | ✅ Yes |
| Cross-format convert | ✅ One-line API | ⚠️ Manual read/write |
| EXIF metadata | ✅ Read, write, copied on convert | ⚠️ Manual |
| ImageIO compatible | ✅ Drop-in plugin | ❌ Own API |
| Image processing | ✅ Resize, crop, rotate, etc. | ❌ Decode/encode only |
| License | Commercial (paid) | LGPL/MIT components (free) |
| Native dependencies | ❌ None (pure Java) | ⚠️ Native C/C++ via JNI |
| Deployment | Single JAR | Compile/bundle native lib per platform |
| JVM crash risk | None (runs in the JVM) | Native faults can take down the process |
| Commercial support | ✅ Dedicated team, bug fixes in days | ❌ Community only |
Key takeaway: Java's ImageIO cannot read or write HEIC at all, so the real choice is between a pure-Java library and a native-backed one. A libheif binding works, but it pulls a C/C++ dependency into your deployment: a native library to compile and bundle per platform, a CVE history to track, and a fault domain outside the JVM. JDeli keeps HEIC handling inside the JVM as a single JAR, at the cost of a commercial license.
HEIC Format Support in Depth
What HEIC Actually Is
HEIC (High Efficiency Image Container) is Apple's name for an image stored in the HEIF container, the format every iPhone has used by default since iOS 11.
The container holds compressed image data plus metadata, and a single file can carry a burst, a live photo, or one image.
Java's ImageIO has no reader or writer for it, which is why an iPhone upload that arrives as .heic fails in otherwise working Java code.
Is HEIC Proprietary?
The HEIF container itself is an open ISO standard (ISO/IEC 23008-12), built on the same base file format as MP4. The compression most HEIC files use is covered by patents, which is the practical reason browsers and language runtimes have been slow to add support. JDeli handles the decoding and encoding for you in pure Java, so you do not assemble a toolchain of native codecs to read a customer's photo.
Reading HEIC
JDeli decodes HEIC to a standard BufferedImage with a single call, reading from a byte[], File, or InputStream.
Once decoded, the image is an ordinary Java object you can process, display, or write out as any other supported format.
Bilevel, greyscale, and RGB images are supported.
Writing HEIC
JDeli encodes a BufferedImage to HEIC and writes to a byte[], File, or OutputStream.
The HeicEncoderOptions class exposes encoder settings when you need control over the output rather than the defaults.
Java's ImageIO cannot write HEIC at all, so this is functionality you cannot get from the JDK.
EXIF Metadata
JDeli reads and writes EXIF metadata in HEIC files. When you convert a HEIC file to another format, the EXIF block is copied across automatically, so camera fields, capture date, and orientation survive the conversion instead of being silently dropped.
Conversion
The JDeli.convert() methods turn a HEIC file into JPG, PNG, or any other supported output in one call, inferring the target format from the output file extension or a format string.
A command-line mode handles batch conversion of a whole directory, which is also how you invoke JDeli from a non-Java process.
Why Use JDeli over Native HEIC Libraries?
ImageIO is not in the running here because it has no HEIC support. The real comparison is against native-backed libraries, and that is where pure Java earns its place.
No native code to deploy
A libheif binding needs a native library present on every machine that runs your code, matched to the architecture and OS. That is a build-and-packaging problem per platform. JDeli is one JAR that runs anywhere the JVM runs, with nothing else to install.
No JVM crashes from native faults
A JNI bridge runs outside the JVM's memory safety model. A fault in the native HEIC layer can bring down the entire Java process, not just throw an exception you can catch. JDeli runs inside the JVM, so a malformed file gives you an exception, not a dead process.
Smaller security surface
The C/C++ libraries behind most HEIC tooling have a real CVE history, and through JNI those vulnerabilities become yours. JDeli makes no calls to native code or external systems, so HEIC parsing stays within Java's managed memory model.
No code rewrite
JDeli ships as an ImageIO plugin. Existing code written against ImageIO.read() and ImageIO.write() picks up HEIC support without changing the calls. You add the plugin JAR and the format your code could not open starts working.
Read and write, not just read
Many HEIC options in the Java ecosystem decode only, leaving no pure-Java path to produce a HEIC file. JDeli reads and writes the format, including EXIF metadata, so round-tripping and re-encoding are first-class operations.
Maintained on a schedule
JDeli ships a release every 6 weeks with a daily pre-release jar for customers, and format bugs are typically fixed within days of a reproducible report. Community-maintained native bindings move on their own timeline, if at all.
Opening HEIC Files in Java
Watch the step-by-step tutorial to see how to read, write, and convert HEIC files using JDeli, from adding the library to your project to writing your first lines of code.
Click for Transcript
Java itself does not support HEIC, so we're going to need to add some additional software. Our JDeli library allows you to read, write, and display HEIC files. Now let's get started with the tutorial.
Firstly, you need to navigate to the JDeli trial page, enter your email address, and click the terms and conditions before generating your trial. Once you have done this, you should receive an email to the email address entered. So let's open the email and see what's happening.
Within the email, we will give you a link to your own personal copy of the trial jar. If you click on that, you will get to the trial jar page. This page allows you not only to access the jar but also provides information on using it in different ways.
I'm just going to download the jar to start with, and then we're going to add some of our own code. Now we can see in our downloads directory that we have the JDeli jar trial. There is a single trial jar for all versions of the code. So now let's add this to a new project.
Let's name our project. I'm going to be naming mine "JDeli HEIC," and this will generate our Java project. This is a standard IntelliJ project, but you can use the same basic principles in any other IDE.
Firstly, we need to add our Java project to the code, then we need to add it to the module settings. This allows us to add the jar. If we go to downloads, we will find the JDeli trial. Now that I've added the JDeli trial to my project, any code I add within this class will allow me to generate some Java code.
Now let's go back to our JDeli trial page where we can find some code for HEIC. This will help us with reading and writing files. What we're actually going to be doing for this demo is reading a HEIC file and then writing it out as another image format. So let's go into this code and add our own code.
The first thing we need to do is fix all the imports. This is a standard function because we have JDeli in the code. Now that's all working. Next, we need to tell it to use the image. I happen to know the path, so I'm just going to enter it now. This should read my file from my downloads.
Now I need to fix a few things. We also have an exception here, so we need to catch that. Let's surround it with a try-catch block. What we're going to do is write this image out as a JPEG file. So I'm going to take the write method and use it to write a JPEG. Obviously, I can use these methods quite liberally for all sorts of image file formats.
Okay, so let's put that in the try-catch block. This code should now take a HEIC file, which I have here, and write it out. I've noticed I quickly need to fix something, so if this happens to you, don't worry. They're always really quick and easy changes. Let's change that to e.printStackTrace().
Now let's run the code, and what we should find is inside here we have a cat file, and here is Lucy. That shows you just how easy it is to use JDeli not only to read HEIC files but to write out multiple image formats at the same time.
Thank you for watching. If you found this useful, don't forget to give it a thumbs up and subscribe, so you can be notified when we have our next "How to HEIC" video.
Trusted by Companies around the World
JDeli handles not only HEIC but other types of file formats as well.
- Joselito M. (Senior Applications Developer at Omaha National)
Frequently asked questions
Does Java ImageIO support HEIC?
No. Java’s built-in ImageIO has no HEIC support. JDeli adds read, write, and convert support via an ImageIO plugin. Drop in the JAR and your existing image-handling code works with HEIC files.
Are there free Java libraries for HEIC?
The main free option is nokiatech/heif, a Java API over native C++ via JNI, which requires native binaries on the server.
Does JDeli support HEIC on Linux and servers?
Yes. JDeli is pure Java with no native dependencies, so it runs on any JVM including Linux servers. Native HEIC alternatives that wrap libheif require platform-specific binaries and can fail after JDK upgrades.
Can I convert a PDF to HEIC in Java?
JDeli does not read PDF files. To convert PDF pages to HEIC in Java, use JPedal. See Convert PDF to HEIC in Java.
How do I convert HEIC to JPG in Java?
Call JDeli.convert(new File("input.heic"), new File("output.jpg")). JDeli infers the output format from the file extension. See Convert HEIC to JPG in Java for a full example.
How do I convert HEIC to PNG in Java?
Call JDeli.convert(new File("input.heic"), new File("output.png")). JDeli infers the output format from the file extension. See Convert HEIC to PNG in Java for a full example.
Why use JDeli for HEIC image support?
1.
2.
3.