Unlocking Apple’s Proprietary HEIC Image Format

JDeli is the pure Java solution for developers working with the HEIC format

What is the HEIC file format?

The Image Format of Apple

The modern image format uses advanced compression to store high-quality photos in smaller file sizes, adopted by Apple in 2017 for its efficient storage and many other advantages over JPEG. Used by over 2.2 billion active Apple devices worldwide, it is one of the most common yet least easy to work with.

Problems with HEIC files in Java

Java developers commonly run into several frustrating and time-consuming problems:

Pure Java support for HEIC

Java's lack of support limits compatibility with modern image standards.

Complicated Open Source Solutions

Free solutions require use of wrappers on native libraries/tools increasing complexity.

Poor HEIC Support on Existing Solutions

Most existing solutions are limited to only reading HEIC files.

Changes in Existing Code

Implementation of HEIC solutions include refactoring existing code.

JVM Crashes

Instability of the platform due to native plugins or heap issues.

Read, Write and Convert HEIC files in pure Java with JDeli

JDeli helps unlock the potential of the file format with a few lines of Java code:

// Read HEIC files

JDeli.read(File heicFile);

JDeli.read(byte[] heicData);

JDeli.read(InputStream heicStream);
// Write HEIC files

JDeli.write(myBufferedImage, "heic");
// 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);

Already using ImageIO?

Java developers that work with ImageIO know of its lack of support for the HEIC format.
JDeli can effortlessly enhance ImageIO with our plugin — your existing image-handling code stays exactly the same!

See How to Open HEIC Files in Java

Watch our step-by-step tutorial to see just how easy it is to read, write, and convert HEIC files using JDeli. From adding the library to your project to writing your first lines of code, we walk you through the whole process.

Click for Transcript
Hi, I'm Alicia and welcome back to our YouTube channel. In today's video, I'm going to be talking you through how to open a HEIC file in Java. If you're unsure what a HEIC file actually is, make sure to watch our YouTube short first. I'll leave this linked in the description below.
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

Abacus logo
Citi logo
Clearsense logo
Honeywell logo
Los Alamos National Lab logo
Mercedes-Benz Bank logo

JDeli is a 100% Java image library with no third party code

Read
  • AVIF
  • BMP
  • GIF
  • HEIC
  • JPG
  • JPEG 2000
  • JPEG XL
  • PNG
  • TIFF
  • WEBP
All formats
Write
  • AVIF
  • BMP
  • GIF
  • HEIC
  • JPG
  • JPEG 2000
  • PNG
  • TIFF
  • WEBP
All formats
Process
  • Blur
  • Brighten
  • Clip
  • Crop
  • Mirror
  • Resize
  • Rotate
  • Sharpen
  • Thumbnail
  • Watermark
All operations
Drop-in replacement for ImageIO
  • Works transparently with existing code
  • No DLLs or 3rd party code used
  • Any feature can be enabled/disabled
Learn more
Convert image formats
  • Direct conversion
  • Translate any supported formats
  • Process/modify image during conversion
Learn more
Compress/Decompress Data
  • Ascii85, AsciiHex, RLE
  • CCITT, DCT, JBIG2, JPX
  • Flate, LZW
Learn more

JDeli handles not only HEIC but other types of file formats as well.

- Joselito M. (Senior Applications Developer at Omaha National)

Why use JDeli for HEIC image support?

1.

Adds HEIC to ImageIO so works with existing code

2.

Uses no native code or third party libraries

3.

Optimised Java code for maximum performance

Try JDeli for Free