Link
Skip to main content

Convert HEIC to BMP

The JDeli Java image conversion library comes with HEIC support makes it very easy to convert HEIC to BMP image files in Java and other languages/scripts.

To run the code examples you will need to download the JDeli jar:

Download JDeli

Video tutorial

Link to video transcript

How to convert HEIC into BMP in Java

  1. Read HEIC image into Java
    BufferedImage bufferedImage = JDeli.read(new File("heicImageFile.heic"));  
    
  2. Process image if needed (scale, sharpen, lighten, watermark, etc)
    bufferedImage = operations.apply(BufferedImage bufferedImage); // Optional
    
  3. Write out BufferedImage as BMP image file
    JDeli.write(bufferedImage, "bmp", new File("bmpImageFile.bmp"));
    

View Javadoc

Export HEIC to BMP in one line of code

The JDeli.convert() methods allow you to save HEIC as BMP in just ONE line of code!

Using File

JDeli.convert(File inFile, File outFile);

Using InputStream and OutputStream

JDeli.convert(InputStream inputStream, OutputStream outputStream, "bmp");

Using byte[]

byte[] outputData = JDeli.convert(byte[] inputData, "bmp");

Configure Output Settings

This option allows you to specify an EncoderOptions object to configure output settings such as image compression.

JDeli.convert(File inFile, EncoderOptions outputOptions, File outfile);

Batch convert HEIC to BMP from command line

Convert images from command line or bash, bat, and powershell scripts. This method can also be used to invoke JDeli from any programming language that allows you to create a child process.

java -jar jdeli.jar --convert bmp "inputFileOrDir" "outputDir"

Video transcript

Click to expand

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 of 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.


Why JDeli?

  • Support image formats such as AVIF, HEIC and JPEG XL (AVIF soon) that are not supported in Java.
  • Process images up to 3x faster than ImageIO and alternative Java image libraries.
  • Prevent JVM crashes caused by native code in other image libraries such as ImageIO.
  • Handle JPEG, PNG, TIFF image file formats fully in Java.
  • Keep your Image files secure as JDeli makes no calls to any external system or third party library.

Learn more about JDeli

Start Your Free Trial