title: Get GPS data from an image Java code
body: <p>I would like to get the metadata from an image file in my local system using Java code</p>
  
  <p>In the attached image you can see the desired data which i would like to pull from java code. </p>
  
  <p><img src="https://i.stack.imgur.com/3QIK5.png" alt="enter image description here"></p>
  
  <p>I wrote the below code and do not seem pull the data mentioned in the "Details" tab. The below code's output is and this is not what I look for.</p>
  
  <pre><code>Started .. 
  Format name: javax_imageio_jpeg_image_1.0
  Format name: javax_imageio_1.0
  </code></pre>
  
  <p>Please give me your ideas. Thanks</p>
  
  <pre><code>try {
              ImageInputStream inStream = ImageIO.createImageInputStream(new File("D:\\codeTest\\arun.jpg"));
              Iterator&lt;ImageReader&gt; imgItr = ImageIO.getImageReaders(inStream);
  
              while (imgItr.hasNext()) {
                  ImageReader reader = imgItr.next();
                  reader.setInput(inStream, true);
                  IIOMetadata  metadata = reader.getImageMetadata(0);
  
                  String[] names = metadata.getMetadataFormatNames();
                  int length = names.length;
                  for (int i = 0; i &lt; length; i++) {
                      System.out.println( "Format name: " + names[ i ] );
                  }  
              }
          } catch (IOException e) {
              e.printStackTrace();
          }
  </code></pre>