Reading EXIF information from a picture file in Android

Download the source code of this article.

EXIF (Exchangeable Image File Format) is a specification for image file formats to store different metadata information. EXIF is supported in JPEG, TIFF and RIFF WAV file formats but not supported in PNG or GIF files. Modern digital cameras use this heavily to store metadata information. EXIF metadata is stored in tag-value format. There are different well known metadata tag values and we can define our own tag values. Most of the modern image manipulation software can interpret EXIF information. For more information about the EXIF format please follow this link.

In Android we can read the EXIF information of a file by using ExifInterface class. This is available from Android version 2.0 onwards. To read EXIF information first we create an instance of the ExifInterface class by passing full path of the image file. Then we can read information using ExifInterface.getAttribute(String), ExifInterface.getAttributeDouble(String) or ExifInterface.getAttributeInt(String) methods by passing the desired tag value. There are different tag values, some of them are:

  • ExifInterface.TAG_DATETIME
  • ExifInterface.TAG_FLASH
  • ExifInterface.TAG_FOCAL_LENGTH
  • ExifInterface.TAG_GPS_DATESTAMP
  • ExifInterface.TAG_GPS_LATITUDE
  • ExifInterface.TAG_GPS_LATITUDE_REF
  • ExifInterface.TAG_GPS_LONGITUDE
  • ExifInterface.TAG_GPS_LONGITUDE_REF
  • ExifInterface.TAG_GPS_PROCESSING_METHOD
  • ExifInterface.TAG_GPS_TIMESTAMP
  • ExifInterface.TAG_IMAGE_LENGTH
  • ExifInterface.TAG_IMAGE_WIDTH
  • ExifInterface.TAG_MAKE
  • ExifInterface.TAG_MODEL
  • ExifInterface.TAG_ORIENTATION
  • ExifInterface.TAG_WHITE_BALANCE

The sample application list all the picture files in the external storage media and when an item is clicked its EXIF information is displayed in another activity.

1 Comment

Add yours →

  1. Thanks great information..was searching about EXIF..

Leave a Reply