• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tiff image compression  RSS feed

 
Balachandran Paranjothimani
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to compress a tiff file with the following settings:

Group 4 Fax Encoding Compression
96 X 96 DPI Resolution

What settings should I use? Here is the code that I am using.

TIFFEncodeParam param = new TIFFEncodeParam();
param.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE);

I have tried to use all the available compression constants defined in TIFFEncodeParam but with no luck. It either throws an exception or creates a file with 770kb in length. The file is a blank white page in tiff format and the windows native application is generating this file with size around 40kb.

TIA
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you show us A) how you're loading the image and B) how you're writing the image. It looks like you're using JAI and you really ought to be using Image I/O, but aside from that fact the documentation also clearly indicates that for Group 4 you should use TIFFEncodeParam.COMPRESSION_GROUP4. If it's throwing exceptions that's probably a hint at what's wrong. One thing I would suspect is that the image isn't bilevel which would explain the larger file size.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!