Skip to content

Most visited

Recently visited

navigation

ExifInterface

public class ExifInterface
extends Object

java.lang.Object
   ↳ android.support.media.ExifInterface


This is a class for reading and writing Exif tags in a JPEG file or a RAW image file.

Supported formats are: JPEG, DNG, CR2, NEF, NRW, ARW, RW2, ORF, PEF, SRW and RAF.

Attribute mutation is supported for JPEG image files.

Summary

Constants

int ORIENTATION_FLIP_HORIZONTAL

int ORIENTATION_FLIP_VERTICAL

int ORIENTATION_NORMAL

int ORIENTATION_ROTATE_180

int ORIENTATION_ROTATE_270

int ORIENTATION_ROTATE_90

int ORIENTATION_TRANSPOSE

int ORIENTATION_TRANSVERSE

int ORIENTATION_UNDEFINED

String TAG_APERTURE_VALUE

Type is rational.

String TAG_ARTIST

Type is String.

String TAG_BITS_PER_SAMPLE

Type is int.

String TAG_BRIGHTNESS_VALUE

Type is rational.

String TAG_CFA_PATTERN

Type is String.

String TAG_COLOR_SPACE

Type is int.

String TAG_COMPONENTS_CONFIGURATION

Type is String.

String TAG_COMPRESSED_BITS_PER_PIXEL

Type is rational.

String TAG_COMPRESSION

Type is int.

String TAG_CONTRAST

Type is int.

String TAG_COPYRIGHT

Type is String.

String TAG_CUSTOM_RENDERED

Type is int.

String TAG_DATETIME

Type is String.

String TAG_DATETIME_DIGITIZED

Type is String.

String TAG_DATETIME_ORIGINAL

Type is String.

String TAG_DEFAULT_CROP_SIZE

Type is int.

String TAG_DEVICE_SETTING_DESCRIPTION

Type is String.

String TAG_DIGITAL_ZOOM_RATIO

Type is double.

String TAG_DNG_VERSION

Type is int.

String TAG_EXIF_VERSION

Type is String.

String TAG_EXPOSURE_BIAS_VALUE

Type is double.

String TAG_EXPOSURE_INDEX

Type is rational.

String TAG_EXPOSURE_MODE

Type is int.

String TAG_EXPOSURE_PROGRAM

Type is int.

String TAG_EXPOSURE_TIME

Type is double.

String TAG_FILE_SOURCE

Type is String.

String TAG_FLASH

Type is int.

String TAG_FLASHPIX_VERSION

Type is String.

String TAG_FLASH_ENERGY

Type is rational.

String TAG_FOCAL_LENGTH

Type is rational.

String TAG_FOCAL_LENGTH_IN_35MM_FILM

Type is int.

String TAG_FOCAL_PLANE_RESOLUTION_UNIT

Type is int.

String TAG_FOCAL_PLANE_X_RESOLUTION

Type is rational.

String TAG_FOCAL_PLANE_Y_RESOLUTION

Type is rational.

String TAG_F_NUMBER

Type is double.

String TAG_GAIN_CONTROL

Type is int.

String TAG_GPS_ALTITUDE

The altitude (in meters) based on the reference in TAG_GPS_ALTITUDE_REF.

String TAG_GPS_ALTITUDE_REF

0 if the altitude is above sea level.

String TAG_GPS_AREA_INFORMATION

Type is String.

String TAG_GPS_DATESTAMP

Type is String.

String TAG_GPS_DEST_BEARING

Type is rational.

String TAG_GPS_DEST_BEARING_REF

Type is String.

String TAG_GPS_DEST_DISTANCE

Type is rational.

String TAG_GPS_DEST_DISTANCE_REF

Type is String.

String TAG_GPS_DEST_LATITUDE

Type is rational.

String TAG_GPS_DEST_LATITUDE_REF

Type is String.

String TAG_GPS_DEST_LONGITUDE

Type is rational.

String TAG_GPS_DEST_LONGITUDE_REF

Type is String.

String TAG_GPS_DIFFERENTIAL

Type is int.

String TAG_GPS_DOP

Type is rational.

String TAG_GPS_IMG_DIRECTION

Type is rational.

String TAG_GPS_IMG_DIRECTION_REF

Type is String.

String TAG_GPS_LATITUDE

Type is rational.

String TAG_GPS_LATITUDE_REF

Type is String.

String TAG_GPS_LONGITUDE

Type is rational.

String TAG_GPS_LONGITUDE_REF

Type is String.

String TAG_GPS_MAP_DATUM

Type is String.

String TAG_GPS_MEASURE_MODE

Type is String.

String TAG_GPS_PROCESSING_METHOD

Type is String.

String TAG_GPS_SATELLITES

Type is String.

String TAG_GPS_SPEED

Type is rational.

String TAG_GPS_SPEED_REF

Type is String.

String TAG_GPS_STATUS

Type is String.

String TAG_GPS_TIMESTAMP

Type is String.

String TAG_GPS_TRACK

Type is rational.

String TAG_GPS_TRACK_REF

Type is String.

String TAG_GPS_VERSION_ID

Type is String.

String TAG_IMAGE_DESCRIPTION

Type is String.

String TAG_IMAGE_LENGTH

Type is int.

String TAG_IMAGE_UNIQUE_ID

Type is String.

String TAG_IMAGE_WIDTH

Type is int.

String TAG_INTEROPERABILITY_INDEX

Type is String.

String TAG_ISO_SPEED_RATINGS

Type is int.

String TAG_JPEG_INTERCHANGE_FORMAT

Type is int.

String TAG_JPEG_INTERCHANGE_FORMAT_LENGTH

Type is int.

String TAG_LIGHT_SOURCE

Type is int.

String TAG_MAKE

Type is String.

String TAG_MAKER_NOTE

Type is String.

String TAG_MAX_APERTURE_VALUE

Type is rational.

String TAG_METERING_MODE

Type is int.

String TAG_MODEL

Type is String.

String TAG_NEW_SUBFILE_TYPE

Type is int.

String TAG_OECF

Type is String.

String TAG_ORF_ASPECT_FRAME

Type is int.

String TAG_ORF_PREVIEW_IMAGE_LENGTH

Type is int.

String TAG_ORF_PREVIEW_IMAGE_START

Type is int.

String TAG_ORF_THUMBNAIL_IMAGE

Type is undefined.

String TAG_ORIENTATION

Type is int.

String TAG_PHOTOMETRIC_INTERPRETATION

Type is int.

String TAG_PIXEL_X_DIMENSION

Type is int.

String TAG_PIXEL_Y_DIMENSION

Type is int.

String TAG_PLANAR_CONFIGURATION

Type is int.

String TAG_PRIMARY_CHROMATICITIES

Type is rational.

String TAG_REFERENCE_BLACK_WHITE

Type is rational.

String TAG_RELATED_SOUND_FILE

Type is String.

String TAG_RESOLUTION_UNIT

Type is int.

String TAG_ROWS_PER_STRIP

Type is int.

String TAG_RW2_ISO

Type is int.

String TAG_RW2_JPG_FROM_RAW

Type is undefined.

String TAG_RW2_SENSOR_BOTTOM_BORDER

Type is int.

String TAG_RW2_SENSOR_LEFT_BORDER

Type is int.

String TAG_RW2_SENSOR_RIGHT_BORDER

Type is int.

String TAG_RW2_SENSOR_TOP_BORDER

Type is int.

String TAG_SAMPLES_PER_PIXEL

Type is int.

String TAG_SATURATION

Type is int.

String TAG_SCENE_CAPTURE_TYPE

Type is int.

String TAG_SCENE_TYPE

Type is String.

String TAG_SENSING_METHOD

Type is int.

String TAG_SHARPNESS

Type is int.

String TAG_SHUTTER_SPEED_VALUE

Type is rational.

String TAG_SOFTWARE

Type is String.

String TAG_SPATIAL_FREQUENCY_RESPONSE

Type is String.

String TAG_SPECTRAL_SENSITIVITY

Type is String.

String TAG_STRIP_BYTE_COUNTS

Type is int.

String TAG_STRIP_OFFSETS

Type is int.

String TAG_SUBFILE_TYPE

Type is int.

String TAG_SUBJECT_AREA

Type is int.

String TAG_SUBJECT_DISTANCE

Type is double.

String TAG_SUBJECT_DISTANCE_RANGE

Type is int.

String TAG_SUBJECT_LOCATION

Type is int.

String TAG_SUBSEC_TIME

Type is String.

String TAG_SUBSEC_TIME_DIGITIZED

Type is String.

String TAG_SUBSEC_TIME_ORIGINAL

Type is String.

String TAG_THUMBNAIL_IMAGE_LENGTH

Type is int.

String TAG_THUMBNAIL_IMAGE_WIDTH

Type is int.

String TAG_TRANSFER_FUNCTION

Type is int.

String TAG_USER_COMMENT

Type is String.

String TAG_WHITE_BALANCE

Type is int.

String TAG_WHITE_POINT

Type is rational.

String TAG_X_RESOLUTION

Type is rational.

String TAG_Y_CB_CR_COEFFICIENTS

Type is rational.

String TAG_Y_CB_CR_POSITIONING

Type is int.

String TAG_Y_CB_CR_SUB_SAMPLING

Type is int.

String TAG_Y_RESOLUTION

Type is rational.

int WHITEBALANCE_AUTO

int WHITEBALANCE_MANUAL

Public constructors

ExifInterface(String filename)

Reads Exif tags from the specified image file.

ExifInterface(InputStream inputStream)

Reads Exif tags from the specified image input stream.

Public methods

void flipHorizontally()

Flips the image horizontally.

void flipVertically()

Flips the image vertically.

double getAltitude(double defaultValue)

Return the altitude in meters.

String getAttribute(String tag)

Returns the value of the specified tag or null if there is no such tag in the image file.

double getAttributeDouble(String tag, double defaultValue)

Returns the double value of the tag that is specified as rational or contains a double-formatted value.

int getAttributeInt(String tag, int defaultValue)

Returns the integer value of the specified tag.

boolean getLatLong(float[] output)

This method was deprecated in API level 25.3.0. Use getLatLong() instead.

double[] getLatLong()

Gets the latitude and longitude values.

byte[] getThumbnail()

Returns the JPEG compressed thumbnail inside the image file, or null if there is no JPEG compressed thumbnail.

Bitmap getThumbnailBitmap()

Creates and returns a Bitmap object of the thumbnail image based on the byte array and the thumbnail compression value, or null if the compression type is unsupported.

byte[] getThumbnailBytes()

Returns the thumbnail bytes inside the image file, regardless of the compression type of the thumbnail image.

long[] getThumbnailRange()

Returns the offset and length of thumbnail inside the image file, or null if there is no thumbnail.

boolean hasThumbnail()

Returns true if the image file has a thumbnail.

boolean isThumbnailCompressed()

Returns true if thumbnail image is JPEG Compressed, or false if either thumbnail image does not exist or thumbnail image is uncompressed.

void resetOrientation()

Resets the TAG_ORIENTATION of the image to be ORIENTATION_NORMAL.

void rotate(int degree)

Rotates the image by the given degree clockwise.

void saveAttributes()

Save the tag data into the original image file.

void setAltitude(double altitude)

Sets the altitude in meters.

void setAttribute(String tag, String value)

Sets the value of the specified tag.

void setGpsInfo(Location location)

Sets the GPS-related information.

void setLatLong(double latitude, double longitude)

Sets the latitude and longitude values.

Inherited methods

From class java.lang.Object

Constants

ORIENTATION_FLIP_HORIZONTAL

added in version 25.1.0
int ORIENTATION_FLIP_HORIZONTAL

Constant Value: 2 (0x00000002)

ORIENTATION_FLIP_VERTICAL

added in version 25.1.0
int ORIENTATION_FLIP_VERTICAL

Constant Value: 4 (0x00000004)

ORIENTATION_NORMAL

added in version 25.1.0
int ORIENTATION_NORMAL

Constant Value: 1 (0x00000001)

ORIENTATION_ROTATE_180

added in version 25.1.0
int ORIENTATION_ROTATE_180

Constant Value: 3 (0x00000003)

ORIENTATION_ROTATE_270

added in version 25.1.0
int ORIENTATION_ROTATE_270

Constant Value: 8 (0x00000008)

ORIENTATION_ROTATE_90

added in version 25.1.0
int ORIENTATION_ROTATE_90

Constant Value: 6 (0x00000006)

ORIENTATION_TRANSPOSE

added in version 25.1.0
int ORIENTATION_TRANSPOSE

Constant Value: 5 (0x00000005)

ORIENTATION_TRANSVERSE

added in version 25.1.0
int ORIENTATION_TRANSVERSE

Constant Value: 7 (0x00000007)

ORIENTATION_UNDEFINED

added in version 25.1.0
int ORIENTATION_UNDEFINED

Constant Value: 0 (0x00000000)

TAG_APERTURE_VALUE

added in version 25.1.0
String TAG_APERTURE_VALUE

Type is rational.

Constant Value: "ApertureValue"

TAG_ARTIST

added in version 25.1.0
String TAG_ARTIST

Type is String.

Constant Value: "Artist"

TAG_BITS_PER_SAMPLE

added in version 25.1.0
String TAG_BITS_PER_SAMPLE

Type is int.

Constant Value: "BitsPerSample"

TAG_BRIGHTNESS_VALUE

added in version 25.1.0
String TAG_BRIGHTNESS_VALUE

Type is rational.

Constant Value: "BrightnessValue"

TAG_CFA_PATTERN

added in version 25.1.0
String TAG_CFA_PATTERN

Type is String.

Constant Value: "CFAPattern"

TAG_COLOR_SPACE

added in version 25.1.0
String TAG_COLOR_SPACE

Type is int.

Constant Value: "ColorSpace"

TAG_COMPONENTS_CONFIGURATION

added in version 25.1.0
String TAG_COMPONENTS_CONFIGURATION

Type is String.

Constant Value: "ComponentsConfiguration"

TAG_COMPRESSED_BITS_PER_PIXEL

added in version 25.1.0
String TAG_COMPRESSED_BITS_PER_PIXEL

Type is rational.

Constant Value: "CompressedBitsPerPixel"

TAG_COMPRESSION

added in version 25.1.0
String TAG_COMPRESSION

Type is int.

Constant Value: "Compression"

TAG_CONTRAST

added in version 25.1.0
String TAG_CONTRAST

Type is int.

Constant Value: "Contrast"

TAG_COPYRIGHT

added in version 25.1.0
String TAG_COPYRIGHT

Type is String.

Constant Value: "Copyright"

TAG_CUSTOM_RENDERED

added in version 25.1.0
String TAG_CUSTOM_RENDERED

Type is int.

Constant Value: "CustomRendered"

TAG_DATETIME

added in version 25.1.0
String TAG_DATETIME

Type is String.

Constant Value: "DateTime"

TAG_DATETIME_DIGITIZED

added in version 25.1.0
String TAG_DATETIME_DIGITIZED

Type is String.

Constant Value: "DateTimeDigitized"

TAG_DATETIME_ORIGINAL

added in version 25.1.0
String TAG_DATETIME_ORIGINAL

Type is String.

Constant Value: "DateTimeOriginal"

TAG_DEFAULT_CROP_SIZE

added in version 25.1.0
String TAG_DEFAULT_CROP_SIZE

Type is int. DNG Specification 1.4.0.0. Section 4

Constant Value: "DefaultCropSize"

TAG_DEVICE_SETTING_DESCRIPTION

added in version 25.1.0
String TAG_DEVICE_SETTING_DESCRIPTION

Type is String.

Constant Value: "DeviceSettingDescription"

TAG_DIGITAL_ZOOM_RATIO

added in version 25.1.0
String TAG_DIGITAL_ZOOM_RATIO

Type is double.

Constant Value: "DigitalZoomRatio"

TAG_DNG_VERSION

added in version 25.1.0
String TAG_DNG_VERSION

Type is int. DNG Specification 1.4.0.0. Section 4

Constant Value: "DNGVersion"

TAG_EXIF_VERSION

added in version 25.1.0
String TAG_EXIF_VERSION

Type is String.

Constant Value: "ExifVersion"

TAG_EXPOSURE_BIAS_VALUE

added in version 25.1.0
String TAG_EXPOSURE_BIAS_VALUE

Type is double.

Constant Value: "ExposureBiasValue"

TAG_EXPOSURE_INDEX

added in version 25.1.0
String TAG_EXPOSURE_INDEX

Type is rational.

Constant Value: "ExposureIndex"

TAG_EXPOSURE_MODE

added in version 25.1.0
String TAG_EXPOSURE_MODE

Type is int.

Constant Value: "ExposureMode"

TAG_EXPOSURE_PROGRAM

added in version 25.1.0
String TAG_EXPOSURE_PROGRAM

Type is int.

Constant Value: "ExposureProgram"

TAG_EXPOSURE_TIME

added in version 25.1.0
String TAG_EXPOSURE_TIME

Type is double.

Constant Value: "ExposureTime"

TAG_FILE_SOURCE

added in version 25.1.0
String TAG_FILE_SOURCE

Type is String.

Constant Value: "FileSource"

TAG_FLASH

added in version 25.1.0
String TAG_FLASH

Type is int.

Constant Value: "Flash"

TAG_FLASHPIX_VERSION

added in version 25.1.0
String TAG_FLASHPIX_VERSION

Type is String.

Constant Value: "FlashpixVersion"

TAG_FLASH_ENERGY

added in version 25.1.0
String TAG_FLASH_ENERGY

Type is rational.

Constant Value: "FlashEnergy"

TAG_FOCAL_LENGTH

added in version 25.1.0
String TAG_FOCAL_LENGTH

Type is rational.

Constant Value: "FocalLength"

TAG_FOCAL_LENGTH_IN_35MM_FILM

added in version 25.1.0
String TAG_FOCAL_LENGTH_IN_35MM_FILM

Type is int.

Constant Value: "FocalLengthIn35mmFilm"

TAG_FOCAL_PLANE_RESOLUTION_UNIT

added in version 25.1.0
String TAG_FOCAL_PLANE_RESOLUTION_UNIT

Type is int.

Constant Value: "FocalPlaneResolutionUnit"

TAG_FOCAL_PLANE_X_RESOLUTION

added in version 25.1.0
String TAG_FOCAL_PLANE_X_RESOLUTION

Type is rational.

Constant Value: "FocalPlaneXResolution"

TAG_FOCAL_PLANE_Y_RESOLUTION

added in version 25.1.0
String TAG_FOCAL_PLANE_Y_RESOLUTION

Type is rational.

Constant Value: "FocalPlaneYResolution"

TAG_F_NUMBER

added in version 25.1.0
String TAG_F_NUMBER

Type is double.

Constant Value: "FNumber"

TAG_GAIN_CONTROL

added in version 25.1.0
String TAG_GAIN_CONTROL

Type is int.

Constant Value: "GainControl"

TAG_GPS_ALTITUDE

added in version 25.1.0
String TAG_GPS_ALTITUDE

The altitude (in meters) based on the reference in TAG_GPS_ALTITUDE_REF. Type is rational.

Constant Value: "GPSAltitude"

TAG_GPS_ALTITUDE_REF

added in version 25.1.0
String TAG_GPS_ALTITUDE_REF

0 if the altitude is above sea level. 1 if the altitude is below sea level. Type is int.

Constant Value: "GPSAltitudeRef"

TAG_GPS_AREA_INFORMATION

added in version 25.1.0
String TAG_GPS_AREA_INFORMATION

Type is String.

Constant Value: "GPSAreaInformation"

TAG_GPS_DATESTAMP

added in version 25.1.0
String TAG_GPS_DATESTAMP

Type is String.

Constant Value: "GPSDateStamp"

TAG_GPS_DEST_BEARING

added in version 25.1.0
String TAG_GPS_DEST_BEARING

Type is rational.

Constant Value: "GPSDestBearing"

TAG_GPS_DEST_BEARING_REF

added in version 25.1.0
String TAG_GPS_DEST_BEARING_REF

Type is String.

Constant Value: "GPSDestBearingRef"

TAG_GPS_DEST_DISTANCE

added in version 25.1.0
String TAG_GPS_DEST_DISTANCE

Type is rational.

Constant Value: "GPSDestDistance"

TAG_GPS_DEST_DISTANCE_REF

added in version 25.1.0
String TAG_GPS_DEST_DISTANCE_REF

Type is String.

Constant Value: "GPSDestDistanceRef"

TAG_GPS_DEST_LATITUDE

added in version 25.1.0
String TAG_GPS_DEST_LATITUDE

Type is rational.

Constant Value: "GPSDestLatitude"

TAG_GPS_DEST_LATITUDE_REF

added in version 25.1.0
String TAG_GPS_DEST_LATITUDE_REF

Type is String.

Constant Value: "GPSDestLatitudeRef"

TAG_GPS_DEST_LONGITUDE

added in version 25.1.0
String TAG_GPS_DEST_LONGITUDE

Type is rational.

Constant Value: "GPSDestLongitude"

TAG_GPS_DEST_LONGITUDE_REF

added in version 25.1.0
String TAG_GPS_DEST_LONGITUDE_REF

Type is String.

Constant Value: "GPSDestLongitudeRef"

TAG_GPS_DIFFERENTIAL

added in version 25.1.0
String TAG_GPS_DIFFERENTIAL

Type is int.

Constant Value: "GPSDifferential"

TAG_GPS_DOP

added in version 25.1.0
String TAG_GPS_DOP

Type is rational.

Constant Value: "GPSDOP"

TAG_GPS_IMG_DIRECTION

added in version 25.1.0
String TAG_GPS_IMG_DIRECTION

Type is rational.

Constant Value: "GPSImgDirection"

TAG_GPS_IMG_DIRECTION_REF

added in version 25.1.0
String TAG_GPS_IMG_DIRECTION_REF

Type is String.

Constant Value: "GPSImgDirectionRef"

TAG_GPS_LATITUDE

added in version 25.1.0
String TAG_GPS_LATITUDE

Type is rational. Format is "num1/denom1,num2/denom2,num3/denom3".

Constant Value: "GPSLatitude"

TAG_GPS_LATITUDE_REF

added in version 25.1.0
String TAG_GPS_LATITUDE_REF

Type is String.

Constant Value: "GPSLatitudeRef"

TAG_GPS_LONGITUDE

added in version 25.1.0
String TAG_GPS_LONGITUDE

Type is rational. Format is "num1/denom1,num2/denom2,num3/denom3".

Constant Value: "GPSLongitude"

TAG_GPS_LONGITUDE_REF

added in version 25.1.0
String TAG_GPS_LONGITUDE_REF

Type is String.

Constant Value: "GPSLongitudeRef"

TAG_GPS_MAP_DATUM

added in version 25.1.0
String TAG_GPS_MAP_DATUM

Type is String.

Constant Value: "GPSMapDatum"

TAG_GPS_MEASURE_MODE

added in version 25.1.0
String TAG_GPS_MEASURE_MODE

Type is String.

Constant Value: "GPSMeasureMode"

TAG_GPS_PROCESSING_METHOD

added in version 25.1.0
String TAG_GPS_PROCESSING_METHOD

Type is String. Name of GPS processing method used for location finding.

Constant Value: "GPSProcessingMethod"

TAG_GPS_SATELLITES

added in version 25.1.0
String TAG_GPS_SATELLITES

Type is String.

Constant Value: "GPSSatellites"

TAG_GPS_SPEED

added in version 25.1.0
String TAG_GPS_SPEED

Type is rational.

Constant Value: "GPSSpeed"

TAG_GPS_SPEED_REF

added in version 25.1.0
String TAG_GPS_SPEED_REF

Type is String.

Constant Value: "GPSSpeedRef"

TAG_GPS_STATUS

added in version 25.1.0
String TAG_GPS_STATUS

Type is String.

Constant Value: "GPSStatus"

TAG_GPS_TIMESTAMP

added in version 25.1.0
String TAG_GPS_TIMESTAMP

Type is String. Format is "hh:mm:ss".

Constant Value: "GPSTimeStamp"

TAG_GPS_TRACK

added in version 25.1.0
String TAG_GPS_TRACK

Type is rational.

Constant Value: "GPSTrack"

TAG_GPS_TRACK_REF

added in version 25.1.0
String TAG_GPS_TRACK_REF

Type is String.

Constant Value: "GPSTrackRef"

TAG_GPS_VERSION_ID

added in version 25.1.0
String TAG_GPS_VERSION_ID

Type is String.

Constant Value: "GPSVersionID"

TAG_IMAGE_DESCRIPTION

added in version 25.1.0
String TAG_IMAGE_DESCRIPTION

Type is String.

Constant Value: "ImageDescription"

TAG_IMAGE_LENGTH

added in version 25.1.0
String TAG_IMAGE_LENGTH

Type is int.

Constant Value: "ImageLength"

TAG_IMAGE_UNIQUE_ID

added in version 25.1.0
String TAG_IMAGE_UNIQUE_ID

Type is String.

Constant Value: "ImageUniqueID"

TAG_IMAGE_WIDTH

added in version 25.1.0
String TAG_IMAGE_WIDTH

Type is int.

Constant Value: "ImageWidth"

TAG_INTEROPERABILITY_INDEX

added in version 25.1.0
String TAG_INTEROPERABILITY_INDEX

Type is String.

Constant Value: "InteroperabilityIndex"

TAG_ISO_SPEED_RATINGS

added in version 25.1.0
String TAG_ISO_SPEED_RATINGS

Type is int.

Constant Value: "ISOSpeedRatings"

TAG_JPEG_INTERCHANGE_FORMAT

added in version 25.1.0
String TAG_JPEG_INTERCHANGE_FORMAT

Type is int.

Constant Value: "JPEGInterchangeFormat"

TAG_JPEG_INTERCHANGE_FORMAT_LENGTH

added in version 25.1.0
String TAG_JPEG_INTERCHANGE_FORMAT_LENGTH

Type is int.

Constant Value: "JPEGInterchangeFormatLength"

TAG_LIGHT_SOURCE

added in version 25.1.0
String TAG_LIGHT_SOURCE

Type is int.

Constant Value: "LightSource"

TAG_MAKE

added in version 25.1.0
String TAG_MAKE

Type is String.

Constant Value: "Make"

TAG_MAKER_NOTE

added in version 25.1.0
String TAG_MAKER_NOTE

Type is String.

Constant Value: "MakerNote"

TAG_MAX_APERTURE_VALUE

added in version 25.1.0
String TAG_MAX_APERTURE_VALUE

Type is rational.

Constant Value: "MaxApertureValue"

TAG_METERING_MODE

added in version 25.1.0
String TAG_METERING_MODE

Type is int.

Constant Value: "MeteringMode"

TAG_MODEL

added in version 25.1.0
String TAG_MODEL

Type is String.

Constant Value: "Model"

TAG_NEW_SUBFILE_TYPE

added in version 25.1.0
String TAG_NEW_SUBFILE_TYPE

Type is int.

Constant Value: "NewSubfileType"

TAG_OECF

added in version 25.1.0
String TAG_OECF

Type is String.

Constant Value: "OECF"

TAG_ORF_ASPECT_FRAME

added in version 25.1.0
String TAG_ORF_ASPECT_FRAME

Type is int. See Olympus Image Processing tags in http://www.exiv2.org/tags-olympus.html.

Constant Value: "AspectFrame"

TAG_ORF_PREVIEW_IMAGE_LENGTH

added in version 25.1.0
String TAG_ORF_PREVIEW_IMAGE_LENGTH

Type is int. See Olympus Camera Settings tags in http://www.exiv2.org/tags-olympus.html.

Constant Value: "PreviewImageLength"

TAG_ORF_PREVIEW_IMAGE_START

added in version 25.1.0
String TAG_ORF_PREVIEW_IMAGE_START

Type is int. See Olympus Camera Settings tags in http://www.exiv2.org/tags-olympus.html.

Constant Value: "PreviewImageStart"

TAG_ORF_THUMBNAIL_IMAGE

added in version 25.1.0
String TAG_ORF_THUMBNAIL_IMAGE

Type is undefined. See Olympus MakerNote tags in http://www.exiv2.org/tags-olympus.html.

Constant Value: "ThumbnailImage"

TAG_ORIENTATION

added in version 25.1.0
String TAG_ORIENTATION

Type is int.

Constant Value: "Orientation"

TAG_PHOTOMETRIC_INTERPRETATION

added in version 25.1.0
String TAG_PHOTOMETRIC_INTERPRETATION

Type is int.

Constant Value: "PhotometricInterpretation"

TAG_PIXEL_X_DIMENSION

added in version 25.1.0
String TAG_PIXEL_X_DIMENSION

Type is int.

Constant Value: "PixelXDimension"

TAG_PIXEL_Y_DIMENSION

added in version 25.1.0
String TAG_PIXEL_Y_DIMENSION

Type is int.

Constant Value: "PixelYDimension"

TAG_PLANAR_CONFIGURATION

added in version 25.1.0
String TAG_PLANAR_CONFIGURATION

Type is int.

Constant Value: "PlanarConfiguration"

TAG_PRIMARY_CHROMATICITIES

added in version 25.1.0
String TAG_PRIMARY_CHROMATICITIES

Type is rational.

Constant Value: "PrimaryChromaticities"

TAG_REFERENCE_BLACK_WHITE

added in version 25.1.0
String TAG_REFERENCE_BLACK_WHITE

Type is rational.

Constant Value: "ReferenceBlackWhite"

TAG_RELATED_SOUND_FILE

added in version 25.1.0
String TAG_RELATED_SOUND_FILE

Type is String.

Constant Value: "RelatedSoundFile"

TAG_RESOLUTION_UNIT

added in version 25.1.0
String TAG_RESOLUTION_UNIT

Type is int.

Constant Value: "ResolutionUnit"

TAG_ROWS_PER_STRIP

added in version 25.1.0
String TAG_ROWS_PER_STRIP

Type is int.

Constant Value: "RowsPerStrip"

TAG_RW2_ISO

added in version 25.1.0
String TAG_RW2_ISO

Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html

Constant Value: "ISO"

TAG_RW2_JPG_FROM_RAW

added in version 25.1.0
String TAG_RW2_JPG_FROM_RAW

Type is undefined. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html

Constant Value: "JpgFromRaw"

TAG_RW2_SENSOR_BOTTOM_BORDER

added in version 25.1.0
String TAG_RW2_SENSOR_BOTTOM_BORDER

Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html

Constant Value: "SensorBottomBorder"

TAG_RW2_SENSOR_LEFT_BORDER

added in version 25.1.0
String TAG_RW2_SENSOR_LEFT_BORDER

Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html

Constant Value: "SensorLeftBorder"

TAG_RW2_SENSOR_RIGHT_BORDER

added in version 25.1.0
String TAG_RW2_SENSOR_RIGHT_BORDER

Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html

Constant Value: "SensorRightBorder"

TAG_RW2_SENSOR_TOP_BORDER

added in version 25.1.0
String TAG_RW2_SENSOR_TOP_BORDER

Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html

Constant Value: "SensorTopBorder"

TAG_SAMPLES_PER_PIXEL

added in version 25.1.0
String TAG_SAMPLES_PER_PIXEL

Type is int.

Constant Value: "SamplesPerPixel"

TAG_SATURATION

added in version 25.1.0
String TAG_SATURATION

Type is int.

Constant Value: "Saturation"

TAG_SCENE_CAPTURE_TYPE

added in version 25.1.0
String TAG_SCENE_CAPTURE_TYPE

Type is int.

Constant Value: "SceneCaptureType"

TAG_SCENE_TYPE

added in version 25.1.0
String TAG_SCENE_TYPE

Type is String.

Constant Value: "SceneType"

TAG_SENSING_METHOD

added in version 25.1.0
String TAG_SENSING_METHOD

Type is int.

Constant Value: "SensingMethod"

TAG_SHARPNESS

added in version 25.1.0
String TAG_SHARPNESS

Type is int.

Constant Value: "Sharpness"

TAG_SHUTTER_SPEED_VALUE

added in version 25.1.0
String TAG_SHUTTER_SPEED_VALUE

Type is rational.

Constant Value: "ShutterSpeedValue"

TAG_SOFTWARE

added in version 25.1.0
String TAG_SOFTWARE

Type is String.

Constant Value: "Software"

TAG_SPATIAL_FREQUENCY_RESPONSE

added in version 25.1.0
String TAG_SPATIAL_FREQUENCY_RESPONSE

Type is String.

Constant Value: "SpatialFrequencyResponse"

TAG_SPECTRAL_SENSITIVITY

added in version 25.1.0
String TAG_SPECTRAL_SENSITIVITY

Type is String.

Constant Value: "SpectralSensitivity"

TAG_STRIP_BYTE_COUNTS

added in version 25.1.0
String TAG_STRIP_BYTE_COUNTS

Type is int.

Constant Value: "StripByteCounts"

TAG_STRIP_OFFSETS

added in version 25.1.0
String TAG_STRIP_OFFSETS

Type is int.

Constant Value: "StripOffsets"

TAG_SUBFILE_TYPE

added in version 25.1.0
String TAG_SUBFILE_TYPE

Type is int.

Constant Value: "SubfileType"

TAG_SUBJECT_AREA

added in version 25.1.0
String TAG_SUBJECT_AREA

Type is int.

Constant Value: "SubjectArea"

TAG_SUBJECT_DISTANCE

added in version 25.1.0
String TAG_SUBJECT_DISTANCE

Type is double.

Constant Value: "SubjectDistance"

TAG_SUBJECT_DISTANCE_RANGE

added in version 25.1.0
String TAG_SUBJECT_DISTANCE_RANGE

Type is int.

Constant Value: "SubjectDistanceRange"

TAG_SUBJECT_LOCATION

added in version 25.1.0
String TAG_SUBJECT_LOCATION

Type is int.

Constant Value: "SubjectLocation"

TAG_SUBSEC_TIME

added in version 25.1.0
String TAG_SUBSEC_TIME

Type is String.

Constant Value: "SubSecTime"

TAG_SUBSEC_TIME_DIGITIZED

added in version 25.1.0
String TAG_SUBSEC_TIME_DIGITIZED

Type is String.

Constant Value: "SubSecTimeDigitized"

TAG_SUBSEC_TIME_ORIGINAL

added in version 25.1.0
String TAG_SUBSEC_TIME_ORIGINAL

Type is String.

Constant Value: "SubSecTimeOriginal"

TAG_THUMBNAIL_IMAGE_LENGTH

added in version 25.1.0
String TAG_THUMBNAIL_IMAGE_LENGTH

Type is int.

Constant Value: "ThumbnailImageLength"

TAG_THUMBNAIL_IMAGE_WIDTH

added in version 25.1.0
String TAG_THUMBNAIL_IMAGE_WIDTH

Type is int.

Constant Value: "ThumbnailImageWidth"

TAG_TRANSFER_FUNCTION

added in version 25.1.0
String TAG_TRANSFER_FUNCTION

Type is int.

Constant Value: "TransferFunction"

TAG_USER_COMMENT

added in version 25.1.0
String TAG_USER_COMMENT

Type is String.

Constant Value: "UserComment"

TAG_WHITE_BALANCE

added in version 25.1.0
String TAG_WHITE_BALANCE

Type is int.

Constant Value: "WhiteBalance"

TAG_WHITE_POINT

added in version 25.1.0
String TAG_WHITE_POINT

Type is rational.

Constant Value: "WhitePoint"

TAG_X_RESOLUTION

added in version 25.1.0
String TAG_X_RESOLUTION

Type is rational.

Constant Value: "XResolution"

TAG_Y_CB_CR_COEFFICIENTS

added in version 25.1.0
String TAG_Y_CB_CR_COEFFICIENTS

Type is rational.

Constant Value: "YCbCrCoefficients"

TAG_Y_CB_CR_POSITIONING

added in version 25.1.0
String TAG_Y_CB_CR_POSITIONING

Type is int.

Constant Value: "YCbCrPositioning"

TAG_Y_CB_CR_SUB_SAMPLING

added in version 25.1.0
String TAG_Y_CB_CR_SUB_SAMPLING

Type is int.

Constant Value: "YCbCrSubSampling"

TAG_Y_RESOLUTION

added in version 25.1.0
String TAG_Y_RESOLUTION

Type is rational.

Constant Value: "YResolution"

WHITEBALANCE_AUTO

added in version 25.1.0
int WHITEBALANCE_AUTO

Constant Value: 0 (0x00000000)

WHITEBALANCE_MANUAL

added in version 25.1.0
int WHITEBALANCE_MANUAL

Constant Value: 1 (0x00000001)

Public constructors

ExifInterface

added in version 25.1.0
ExifInterface (String filename)

Reads Exif tags from the specified image file.

Parameters
filename String

Throws
IOException

ExifInterface

added in version 25.1.0
ExifInterface (InputStream inputStream)

Reads Exif tags from the specified image input stream. Attribute mutation is not supported for input streams. The given input stream will proceed its current position. Developers should close the input stream after use. This constructor is not intended to be used with an input stream that performs any networking operations.

Parameters
inputStream InputStream

Throws
IOException

Public methods

flipHorizontally

added in version 26.0.0
void flipHorizontally ()

Flips the image horizontally.

flipVertically

added in version 26.0.0
void flipVertically ()

Flips the image vertically.

getAltitude

added in version 25.1.0
double getAltitude (double defaultValue)

Return the altitude in meters. If the exif tag does not exist, return defaultValue.

Parameters
defaultValue double: the value to return if the tag is not available.

Returns
double

getAttribute

added in version 25.1.0
String getAttribute (String tag)

Returns the value of the specified tag or null if there is no such tag in the image file.

Parameters
tag String: the name of the tag.

Returns
String

getAttributeDouble

added in version 25.1.0
double getAttributeDouble (String tag, 
                double defaultValue)

Returns the double value of the tag that is specified as rational or contains a double-formatted value. If there is no such tag in the image file or the value cannot be parsed as double, return defaultValue.

Parameters
tag String: the name of the tag.

defaultValue double: the value to return if the tag is not available.

Returns
double

getAttributeInt

added in version 25.1.0
int getAttributeInt (String tag, 
                int defaultValue)

Returns the integer value of the specified tag. If there is no such tag in the image file or the value cannot be parsed as integer, return defaultValue.

Parameters
tag String: the name of the tag.

defaultValue int: the value to return if the tag is not available.

Returns
int

getLatLong

added in version 25.1.0
boolean getLatLong (float[] output)

This method was deprecated in API level 25.3.0.
Use getLatLong() instead.

Stores the latitude and longitude value in a float array. The first element is the latitude, and the second element is the longitude. Returns false if the Exif tags are not available.

Parameters
output float

Returns
boolean

getLatLong

added in version 25.3.0
double[] getLatLong ()

Gets the latitude and longitude values.

If there are valid latitude and longitude values in the image, this method returns a double array where the first element is the latitude and the second element is the longitude. Otherwise, it returns null.

Returns
double[]

getThumbnail

added in version 25.1.0
byte[] getThumbnail ()

Returns the JPEG compressed thumbnail inside the image file, or null if there is no JPEG compressed thumbnail. The returned data can be decoded using decodeByteArray(byte[], int, int)

Returns
byte[]

getThumbnailBitmap

added in version 25.1.0
Bitmap getThumbnailBitmap ()

Creates and returns a Bitmap object of the thumbnail image based on the byte array and the thumbnail compression value, or null if the compression type is unsupported.

Returns
Bitmap

getThumbnailBytes

added in version 25.1.0
byte[] getThumbnailBytes ()

Returns the thumbnail bytes inside the image file, regardless of the compression type of the thumbnail image.

Returns
byte[]

getThumbnailRange

added in version 25.1.0
long[] getThumbnailRange ()

Returns the offset and length of thumbnail inside the image file, or null if there is no thumbnail.

Returns
long[] two-element array, the offset in the first value, and length in the second, or null if no thumbnail was found.

hasThumbnail

added in version 25.1.0
boolean hasThumbnail ()

Returns true if the image file has a thumbnail.

Returns
boolean

isThumbnailCompressed

added in version 25.1.0
boolean isThumbnailCompressed ()

Returns true if thumbnail image is JPEG Compressed, or false if either thumbnail image does not exist or thumbnail image is uncompressed.

Returns
boolean

resetOrientation

added in version 26.0.0
void resetOrientation ()

Resets the TAG_ORIENTATION of the image to be ORIENTATION_NORMAL.

rotate

added in version 26.0.0
void rotate (int degree)

Rotates the image by the given degree clockwise. The degree should be a multiple of 90 (e.g, 90, 180, -90, etc.).

Parameters
degree int: The degree of rotation.

saveAttributes

added in version 25.1.0
void saveAttributes ()

Save the tag data into the original image file. This is expensive because it involves copying all the data from one file to another and deleting the old file and renaming the other. It's best to use setAttribute(String, String) to set all attributes to write and make a single call rather than multiple calls for each attribute.

This method is only supported for JPEG files.

Throws
IOException

setAltitude

added in version 26.0.0
void setAltitude (double altitude)

Sets the altitude in meters.

Parameters
altitude double

setAttribute

added in version 25.1.0
void setAttribute (String tag, 
                String value)

Sets the value of the specified tag.

Parameters
tag String: the name of the tag.

value String: the value of the tag.

setGpsInfo

added in version 26.0.0
void setGpsInfo (Location location)

Sets the GPS-related information. It will set GPS processing method, latitude and longitude values, GPS timestamp, and speed information at the same time.

Parameters
location Location: the Location object returned by GPS service.

setLatLong

added in version 25.3.0
void setLatLong (double latitude, 
                double longitude)

Sets the latitude and longitude values.

Parameters
latitude double: the decimal value of latitude. Must be a valid double value between -90.0 and 90.0.

longitude double: the decimal value of longitude. Must be a valid double value between -180.0 and 180.0.

Throws
IllegalArgumentException If latitude or longitude is outside the specified range.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)