Java BMP Reader
The JDeli Java image library includes a BMP Reader to read BMP images into Java. The BMP Decoder is written in 100% Java and provides BMP support with no dependencies.
Key information:
- 100% Java solution. No dlls or dependencies on native code
- Supports Bilevel, Grayscale and RGB images
Quick start:
Add JDeli to your project via Maven or Gradle, or see using JDeli with Java modules.
JDeli can automatically detect the file type and will use the BMP File Reader
BufferedImage image = JDeli.read(bmpImageFile);
or
BmpDecoder decoder = new BmpDecoder();
BufferedImage image = decoder.read(bmpData);
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 |
|---|---|---|
| ImageIO | 56.383 | ± 0.373 |
| JDeli | 171.242 | ± 0.124 |
Tested on 2020 13inch M1 MacBook Pro using JDK 18.0.1.1
Frequently asked questions
Does JDeli produce better BMP reading and decoding than Java ImageIO?
Yes. While ImageIO can read BMP, JDeli provides better compatibility, more consistent output across platforms, and access to format-specific decoding options.
Does reading or decoding BMP 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 input types does JDeli support for reading BMP?
JDeli can read and decode BMP from a File, InputStream, or byte array.