• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

HELP! finding image compression type

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone!
I am in the process of writing an application that processes tiff files.

I have a requirement that I have to check to confirm that the image has group 4 compression type.

I have successfully implemented this using imagemagick/jmagick..... but due to certain circumstances, we are not able to use jmagick.

I am now using JAI to split multi page tiff files and iText.jar to find the DPI of these images... however I still need to find the compression type!

Does anyone know how to find an image compression type using a method other than image magick/ jmagick?? If so... please provide me with any download links and a few lines of example code!!!

A big virtual hug to whoever might have a solution for me!!!

Thanks so much!

p.s. it is in a linux environment.
 
mike dib
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P.S. I've alredy tried the functions:

Method Summary
int getCompression()
Returns the value of the compression parameter.
int getDeflateLevel()
Gets the compression level for DEFLATE compression.

located at: http://download.oracle.com/docs/cd/E17802_01/products/products/java-media/jai/forDevelopers/jai-apidocs/com/sun/media/jai/codec/TIFFEncodeParam.html

They return 1 for getCompression and -1 for getDeflateLevel regardless of what compression type the image i run through them are.

 
mike dib
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I Resolved this issue- for those of you who attempt to do the same here is how:

reference jar files jai-core-1.1.3-alpha.jar

start code

File file = new File(filepath);
RenderedOp page = JAI.create("fileload",file.getCanonicalPath());
TIFFDirectory dir = (TIFFDirectorypage.getProperty("tiff_directory");
TIFFField compress = dir.getField(259);
System.out.println("The compression is: " compress.getAsInt(0));

end code

The value 4 is equal to group 4 compression.

Cheers
 
I'm so happy! And I wish to make this tiny ad happy too:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic