• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Image compression and decompression

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic