This discussion is archived
3 Replies Latest reply: Oct 10, 2012 10:20 AM by DrClap RSS

How to get the Summary details of jpg file like (title, subject, author)

Ramesh V Newbie
Currently Being Moderated
Hi All,


Plz help me out of this Reading Windows file summary properties (title, subject, author) in Java.
When select properties giing right click on the file after that window open with the three tabs containg General,Security,Summary.
From the Summary tab i need to pull the data (title, subject, author) using Java api.

Regards
Ramesh
  • 1. Re: How to get the Summary details of jpg file like (title, subject, author)
    Kayaman Guru
    Currently Being Moderated
    I would suggest you look for a library meant for JPEG file handling. And maybe check out ImageIO to see whether you can do it with the standard Java API.
  • 2. Re: How to get the Summary details of jpg file like (title, subject, author)
    Ramesh V Newbie
    Currently Being Moderated
    I tried many ways using ImageIO, ImageReader

    ImageInputStream inStream = ImageIO.createImageInputStream(new File("E:\\Ramesh\\Blue hills.jpg"));
                   Iterator<ImageReader> imgItr = ImageIO.getImageReaders(inStream);
                   while (imgItr.hasNext())
                   {                
                        ImageReader reader = imgItr.next();
                        reader.setInput(inStream, true);
                   String fm = reader.getFormatName();
                   System.out.println("format name : " + fm );
                   
                   Raster raster = reader.readRaster(0, null);
                        IIOMetadata metadata = reader.getImageMetadata(0);
                        reader.getOriginatingProvider();
                                            
                        String[] names = metadata.getMetadataFormatNames();
                   
                        int length = names.length;
                        for (int i = 0; i < length; i++)
                        {                   
                             System.out.println( "Format name: " + names[ i ] );
                             }
                        }
  • 3. Re: How to get the Summary details of jpg file like (title, subject, author)
    DrClap Expert
    Currently Being Moderated
    In that case, as already pointed out, libraries for extracting JPG metadata do exist and you should be able to find them. I have used one myself and it worked perfectly well. However this was four years ago, on a different computer, and I don't remember its name. That shouldn't stop you from finding it in under a minute yourself, though.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points