aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Image compression and decompression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Image compression and decompression" Watch "Image compression and decompression" New topic
Author

Image compression and decompression

Ruchika Verma
Greenhorn

Joined: Sep 19, 2008
Posts: 4
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.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
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 ?


Ping & DNS - updated with new look and Ping home screen widget
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19542
    
  16

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ruchika Verma
Greenhorn

Joined: Sep 19, 2008
Posts: 4
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image compression and decompression
 
Similar Threads
What to extract JWebPlus ?
Transfer big files as byte array over network
Decompress Unix compressed .z file
Code for basic java classes
Pixels and Pictures