I am searching for a way to compress and decompress a BMP Image in java.
I found an easy way using javax.imageio , like the following tutorial .
using the following two classes (ImageWriter , ImageWriteParam) , but the example provided is just compressing an Image .
what i am looking for is use the same classes and the same mechanism to decompress "my compressed image" that i got from the provided example .
Is there anyway to do this with same mechanism ?
any other solution to compress a BMP are also welcome .
Thanks in Advance.
The simplest ways to read and write images in Java using ImageIO, is just using the
read
andwrite
static methods directly.Read:
Write:
Using the
ImageReader
andImageReadParam
, andImageWriter
andImageWriteParam
respectively (as in the tutorial), gives more control over what parts of the image to decode, size or region, or format features such as compression type, quality to encode etc., if you need it.