Link
Skip to main content

Java BMP Writer

Java’s built-in ImageIO has limited support for writing BMP files and provides little control over encoding quality and format-specific options. JDeli is a 100% Java BMP writer that gives you full encoding control with no dependencies.

Getting started

Add JDeli to your project via Maven or Gradle, or see using JDeli with Java modules.

Key features:

  • 100% Java solution. No dlls or dependencies on native code
  • ColorSpace: RGB, GrayScale and Indexed images
  • Subtypes: RGB555, RGB565, RGB24, RGB32, ARGB32

Quick start or to replace in existing code using ImageIO:

JDeli.write(myBufferedImage, "bmp", outputStreamOrFile);

or

byte[] outputData = JDeli.write(myBufferedImage, "bmp");

Simple usage

JDeli.write(myBufferedImage, OutputFormat.BMP, outputStreamOrFile);

OutputFormat allows setting of any supported Image Format

For complete control of output:

final BmpEncoderOptions options = new BmpEncoderOptions();

//set any options in options instance - examples below

//As of the 2025.05 release, you can set the bmp subtype to write out as. For example:
options.setOutputSubtype(BufferedImage.TYPE_USHORT_565_RGB); 

//write out
JDeli.write(myBufferedImage, options, outputStreamOrFile);

BmpEncoderOptions allows setting of specific options.

Various image processing operations can be conducted on the image, detailed documentation can be found here.

Performance comparisons:

These figures were generated using jmh (as documented on our blog) with a standard set of images (also documented). They should be easy to replicate if you wish to validate, the code is on GitHub.

The higher the number, the better.

Mode: Throughput Count: 25 Units: ops/s

Benchmark Score Error
Apache 10.684 ± 0.027
ImageIO 5.288 ± 0.484
JDeli 17.223 ± 0.064

Number of files: 166

Benchmark Size unreadable output AVG SSIM score AVG Similarity
Apache 4.76Mb 0 1.0 Identical or virtually identical
ImageIO 4.73Mb 30 0.4430668957720272 Very different
JDeli 4.83Mb 0 0.9684172944944214 Very similar (high quality)

Frequently asked questions

Does JDeli produce better BMP output than Java ImageIO?

Yes. While ImageIO can write BMP, JDeli gives you full control over encoding options such as compression and quality, and produces more consistent output across platforms.

Does writing BMP in Java require native 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 BMP?

JDeli can write BMP to a File, OutputStream, or return the encoded data as a byte array.


Why JDeli?

  • Support image formats such as AVIF, HEIC and JPEG XL 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