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

How can I store metadata in an image file?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am writing a system that reads in XML files and processes the data. The core part of this system is nearly complete. I now have a requirement that allows users to submit image documents (e.g. jpg, jpeg, pdf, png, tif, and tiff) into a particular folder location. At a high level, when these files arrive, my process routes these files to another folder based on the filename. This works well enough for the more simple case, but I don't think it scales very well when you consider there may be more destination folders with more complex rules that determine the proper routing. I would like to take an approach based on reading metadata inside the files -- I understand that some files may have a file header section that is separate from the actual data.

This seems like it would be straightforward with However, I think that was introduced with the NIO in Java 7. Right now, I have a requirement to run on servers that are running Java 6. My first preference would be to find a way to code this in Java without too much effort and without relying on a third party solution. Any ideas?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I doubt that the NIO class you mention can be used to read metadata from image files.

How and what metadata is stored in files depends on the file format.

The ImageIO API (the package javax.imageio) has classes and methods to read and write metadata from different image file formats. For example class ImageReader has different getImageMetadata methods. You'll have to study that API to find out how to read metadata from image files. See also the package javax.imageio.metadata.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic