2

I want to read properties like created_date, modified_date, creator, etc... in Java, of the below image file formats:

  • GIF file
  • JPEG
  • TIFF
  • CDR

I have used javax.imageio but I didn't find the solution. Any help would be appreciated

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
prasanna
  • 51
  • 2
  • 7
  • You could take look at this [example](http://stackoverflow.com/questions/22188940/gif-image-doesnt-moves-on-adding-it-to-the-jtabbed-pane/22190844#22190844) which uses the meta-data from a GIF to render the animation contained within – MadProgrammer Jun 23 '14 at 06:33
  • Have a look here http://www.exiv2.org – Mark Setchell Jun 23 '14 at 08:06

2 Answers2

3

you can use metadata-extractor like ..

Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
Muhammad Suleman
  • 2,892
  • 2
  • 25
  • 33
  • i have tried this but i wont be able to get metadata like created date,modified date,creator etc – prasanna Jun 27 '14 at 06:35
  • 1
    @prasanna, you can get all those values and more using the library. Check [here](https://github.com/drewnoakes/metadata-extractor/wiki/GettingStarted#query-the-raw-value-of-a-specific-tag) for information on how to access a specific tag's value. – Drew Noakes Feb 02 '15 at 08:52
  • @DrewNoakes but is there a generic approach? Especially for image dimension the only way I found with your library so far is to deal with specific implementation, while I would just like to have something like `Image#getWidth`. It is kind of a pain to have to know that for `jpeg` that is value `3` and for `png` is `1`. Maybe a new question? – ThanksForAllTheFish Nov 18 '16 at 11:52
  • @ThanksForAllTheFish not in the library. It would be a useful addition, though tricky to get right. This issue tracks the idea, so please share your thoughts there https://github.com/drewnoakes/metadata-extractor/issues/10 – Drew Noakes Nov 18 '16 at 11:55
1

Try Apache Tika. It's very mature and well-suported metadata extraction libraty.

Nailgun
  • 3,999
  • 4
  • 31
  • 46