This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image compression and decompression

 
Ruchika Verma
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Rob Spoor
Sheriff
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ruchika Verma
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic