Forums Register Login

Image compression and decompression

+Pie Number of slices to send: Send
Hi,
I have compressed an image using ImageWriteParam class in ImageIO to reduce its size for image transfer. Now I want to decompress it. I urgently need the code to decompress the image. Please help.
+Pie Number of slices to send: Send
Welcome to JavaRanch.

It's hard to say what might need to be done for decompression, since we don't know what you did for compression. What happens if you try to open the image with ImageIO.read ?
+Pie Number of slices to send: Send
In most cases it's not possible to decompress images. The reason is that the compression is lossy - it will remove part of the data which cannot be retrieved. Especially JPEG is quite lossy.

If you want lossless transfer, either change the image type or use a reversable compression algorithm like GZip.
+Pie Number of slices to send: Send
Ok. Thanks. But when I try to compress Tiff images with same lossy compression technique I get an exception. Can you share the code to compress Tiff image using lossy compression.
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 4199 times.
Similar Threads
Code for basic java classes
Transfer big files as byte array over network
Decompress Unix compressed .z file
What to extract JWebPlus ?
Pixels and Pictures
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:09:42.