3 Replies Latest reply: Oct 10, 2012 12:20 PM by DrClap RSS

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

    Ramesh V
      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
          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
            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
              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.