• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Reduce image size after converting to TIFF image with compression type

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator




Using the above code to convert from jpeg to tiff.
I want to compress the image so using compression types from http://download.java.net/media/jai-imageio/javadoc/1.1/com/sun/media/imageio/plugins/tiff/TIFFImageWriteParam.html




Is there any other compression type or way which can give me more smaller or same size as that of original image?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Might be relevant. I've just noticed that what one creates the
then FileImageOutputStreamSpi creates javax.imageio.stream.FileImageOutputStream, which in turn does new RandomAccessFile(f, "rw") and that does not overwrite / truncate the output file, but re-uses it. That means TIFFImageWriter writes to it up to necessary position, but the trailing "junk" stays there. Which means that if you write in your test scenario to the same output file, and by chance started with uncompressed scenario, then filesize will not change and will stay the same but modification time changes.

If that is not your case, then I would say that LZW (lossless compression) generally cannot be better than JPEG (lossy). Also, what do you refer as "Original image"? You should refer raster as original image, e.g. try to write to TIFF without compression – that will be your baseline.
 
reply
    Bookmark Topic Watch Topic
  • New Topic