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.
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.
You can thank my dental hygienist for my untimely aliveness. So tiny: