Read and Write BMP Files in Java with JDeli
JDeli Image Library provides pure-Java BMP support, allowing you to read, write, and convert BMP files without native dependencies. Java’s built-in ImageIO can read and write BMP, but it cannot convert BMP images to modern formats such as AVIF, HEIC, or WebP. JDeli reads and writes RGB, ARGB, grayscale, and indexed BMP images, lets you choose the BMP subtype to write, and converts BMP files to any other format JDeli supports, all in pure Java.
Frequently Asked Questions
Does Java support BMP natively?
Yes. Java’s built-in ImageIO can read and write BMP files. JDeli provides an alternative pure-Java BMP reader and writer, and can also convert BMP files to formats ImageIO cannot write, such as AVIF, HEIC, and WebP.
Can JDeli read BMP files in Java?
Yes. JDeli can read BMP files and return a BufferedImage, which can then be processed or converted to any other supported format.
Can JDeli write BMP files in Java?
Yes. JDeli can write BufferedImage objects to BMP format. The BmpEncoderOptions class lets you set the BMP subtype to write, such as RGB565. See the Java BMP writer guide for a code example.
Which BMP image types does JDeli support?
JDeli supports RGB32, ARGB32, RGB24, RGB565, RGB555, grayscale, and indexed BMP images, including alpha transparency. Uncompressed BMP files are supported. RLE-compressed BMP files are not.
How do I convert BMP to JPEG in Java?
JDeli’s convert method provides a single call to convert directly from BMP to JPEG. JDeli handles the conversion entirely in Java with no native tools required.
How do I convert BMP to PNG in Java?
JDeli’s convert method provides a single call to convert directly from BMP to PNG. JDeli handles the conversion entirely in Java with no native tools required.
Does JDeli’s BMP support require native libraries?
No. JDeli’s BMP implementation is pure Java. It runs consistently across platforms without the JVM crash risk that comes from native-dependent alternatives.
Can JDeli be used with ImageIO for BMP files?
Yes. JDeli is available as an ImageIO plugin. Once the BMP reader and writer are registered through the plugin, existing code that calls ImageIO.read() and ImageIO.write() will use JDeli for BMP files. See the ImageIO migration guide for details.