File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes HELP! finding image compression type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "HELP! finding image compression type" Watch "HELP! finding image compression type" New topic
Author

HELP! finding image compression type

mike dib
Greenhorn

Joined: Feb 09, 2011
Posts: 3
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

Joined: Feb 09, 2011
Posts: 3
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

Joined: Feb 09, 2011
Posts: 3
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: HELP! finding image compression type
 
Similar Threads
Problem Sending Tiff Image in Servlet response
How to set photometricInterpretation property while storing TIFF using JAI?
Problem with conversion of tiff images (.odm) to pdf files...
gif to jpg help needed
Image compression and decompression