This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes get information from TIFF files Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "get information from TIFF files" Watch "get information from TIFF files" New topic
Author

get information from TIFF files

Connie Kam
Greenhorn

Joined: Aug 03, 2007
Posts: 6
Hi,

I need to write a small app that I can point at a directory of TIFF files and extract the dpi from each file and store this elsewhere. Can someone point me to an API or such which gives me the ability to extract the dpi information from the image header or such?

Connie
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35446
    
    9
Welcome to JavaRanch.

The ImageInfo class can get you that information.


Android appsImageJ pluginsJava web charts
Connie Kam
Greenhorn

Joined: Aug 03, 2007
Posts: 6
Thanks Ulf,

I had looked at this but TIFF is not included in the spec, the reasons why are given here:
http://schmidt.devlib.org/image-info/#tiff

But that doesn't help me much.

I don't need to open the files just do a checksum, get a value, get the dpi value and pass the filename, checksum and dpi to a table.

Connie
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35446
    
    9
Sorry about that; for some reason I was convinced that it could handle TIFFs.

I don't understand what you mean by "I don't need to open the files", though. How else can that information be extracted?
Connie Kam
Greenhorn

Joined: Aug 03, 2007
Posts: 6
I mean I don't need to display the image.

What is happening is a have a directory of 14000 image files in TIFF. These have to be converted to jpeg2000. Some of these were scanned at 300dpi(approx 12500) and some at 150dpi, some were photographed using a digital camera and have a different dpi. I need to be able to create an excel file (or similar) which has the TIFF filename, the dpi of the image, and the checksum. The conversion is done in Kakadu by another programmers program, he needs to know which files are in the lower dpi because the conversion needs different parameters when the dpi is lower. So I have been asked to create a small app to point at the TIFF files and get this information.

Sorry for not explaining well

Connie
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Take a look whether you find something helpful in the Java Advanced Imaging API.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Connie Kam
Greenhorn

Joined: Aug 03, 2007
Posts: 6
Thanks for the direction guys.

I found exactly what I needed in the Java advanced imaging stuff. I have written myself a little swing app and apart from a few jar issues, am pretty pleased with the result.

Connie
Thanuja Sethuraman
Greenhorn

Joined: Aug 24, 2007
Posts: 1
Hi i too have the same requirement. I need to get the image file dpi and pixel while uploading it to server and convert it to inches using the formula



how did you get the dpi of the image using JAI? can you give me the link to download JAI and the code to get the dpi. Is it possible to get the dpi for all the image types like jpeg,tiff,eps etc.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get information from TIFF files
 
Similar Threads
Java library for watermarking PDF, TIFF files?
How to change the DPI of a image
How to change the DPI of a image
How to read DPI from an Image
HELP! finding image compression type