• 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

get information from TIFF files

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

The ImageInfo class can get you that information.
 
Connie Kam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look whether you find something helpful in the Java Advanced Imaging API.
 
Connie Kam
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic