Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save image file in BMP format?

the following code compress my image or it is not a BMP file:

FileOutputStream fos = new FileOutputStream(imagefile);

bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();

How can I save my image in BMP format?


1 Answers

There's no built-in encoder for BMP according to this reference. BMP not being an overly complex format, it probably wouldn't be rocket science to write/find a Java implementation.

like image 136
Rob Pridham Avatar answered Dec 07 '25 20:12

Rob Pridham



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!