Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Tiff image compression

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic