BMP (Bitmap) is a raster graphics format known for its simplicity and compatibility. It stores image data in an uncompressed format, resulting in large file sizes.
BMP images are commonly used in Windows environments and supported by various software applications. Converting BMP images to JPG can significantly reduce file size, making them easier to store and share while maintaining reasonable image quality.
In this article, I’ll guide you through the process of using Java to convert BMP files to JPG format with JDeli, ensuring your images are accessible.
Mass convert BMP to JPG using Java
- Download the JDeli trial jar.
- Process image if needed (scale, sharpen, lighten, watermark, etc)
- Write out BufferedImage as JPG image file
BufferedImage bufferedImage = JDeli.read(new File("bmpImageFile.bmp"));
// Read BMP image into Java
bufferedImage = operations.apply(BufferedImage bufferedImage);
// Process BMP image (Optional)
JDeli.write(bufferedImage, "jpg", new File("jpgImageFile.jpg"));
// Write out BufferedImage as JPEG image file
Export BMP to JPG in one line of code
With the JDeli.convert()
method you can save BMP as JPG in just one line of code.
Using File
JDeli.convert(File inFile, File outFile);
Using InputStream and OutputStream
JDeli.convert(InputStream inputStream, OutputStream outputStream, "jpg");
Using byte[]
byte[] outputData = JDeli.convert(byte[] inputData, "jpg");
Configure Output Settings
You can configure output settings, such as image compression, by specifying an EncoderOptions object with this option.
JDeli.convert(File inFile, EncoderOptions outputOptions, File outfile);
How to bulk convert BMP to JPG from the command line
You can use command line or bash, bat, and PowerShell scripts to mass convert BMP to JPG. This method also allows you to invoke JDeli from any programming language that supports creating a child process.
java -jar jdeli.jar –convert jpg "inputFileOrDir" "outputDir"
In this tutorial you learned how to bulk convert BMP to JPG, take a look at our support site for more format conversions.
Are you a Java Developer working with Image files?
// Read an image
BufferedImage bufferedImage = JDeli.read(dicomImageFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(heicImageFile);
// Write an image
JDeli.write(bufferedImage, "heic", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(jpegImageFile);
// Write an image
JDeli.write(bufferedImage, "jpeg", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(jpeg2000ImageFile);
// Write an image
JDeli.write(bufferedImage, "jpx", outputStreamOrFile);
// Write an image
JDeli.write(bufferedImage, "pdf", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(pngImageFile);
// Write an image
JDeli.write(bufferedImage, "png", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(tiffImageFile);
// Write an image
JDeli.write(bufferedImage, "tiff", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(webpImageFile);
// Write an image
JDeli.write(bufferedImage, "webp", outputStreamOrFile);
What is JDeli?
JDeli is a commercial Java Image library that is used to read, write, convert, manipulate and process many different image formats.
Why use JDeli?
To handle many well known formats such as JPEG, PNG, TIFF as well as newer formats like AVIF, HEIC and JPEG XL in java with no calls to any external system or third party library.
What licenses are available?
We have 3 licenses available:
Server for on premises and cloud servers, Distribution for use in a named end user applications, and Custom for more demanding requirements.
What's our Story?
We are a small company who have been developing innovative Java, PDF and HTML5 solutions for over 25 years.