ExifInterface


public class ExifInterface


This is a class for reading and writing Exif tags in various image file formats.

Supported for reading: JPEG, PNG, WebP, HEIC, DNG, CR2, NEF, NRW, ARW, RW2, ORF, PEF, SRW, RAF, AVIF (on API 31+).

Supported for writing: JPEG, PNG, WebP.

XMP Support

This class can read raw XMP data from the supported image file formats.

XMP data can be stored within Exif data (under tag 700), but many of the formats also define a separate storage location for XMP. ExifInterface handles this ambiguity as follows:

  • JPEG
    • The XMP spec part 3 section 3.3.2 forbids the XMP tag (700) being present in the Exif segment of JPEG files (i.e. XMP should always be in a separate APP1 segment).
    • If XMP is present in both Exif and separate segments, the XMP from the Exif segment is returned from getAttributeBytes and modifications to the XMP with setAttribute are written back to the XMP in the Exif segment, the XMP in the separate segment is preserved unmodified. This is contrary to the spec described above (which suggests the standalone XMP should be preferred over the XMP in the Exif segment).
    • If XMP is not present in either location, and is added with setAttribute, it is written as a standalone segment, in line with the spec described above.
  • HEIC &AVIF
    • If XMP is present in both Exif and separate segments, the XMP from the separate segment is returned from getAttributeBytes.

Summary

Constants

static final short

The constant used by TAG_GPS_ALTITUDE_REF to denote the altitude is above sea level.

static final short

The constant used by TAG_GPS_ALTITUDE_REF to denote the altitude is below sea level.

static final int[]

The constant used by TAG_BITS_PER_SAMPLE.

static final int[]

The constant used by TAG_BITS_PER_SAMPLE.

static final int[]

The constant used by TAG_BITS_PER_SAMPLE.

static final int

The constant used by TAG_COLOR_SPACE to denote sRGB color space.

static final int

The constant used by TAG_COLOR_SPACE to denote Uncalibrated.

static final short

The constant used by TAG_CONTRAST to denote hard contrast.

static final short

The constant used by TAG_CONTRAST to denote normal contrast.

static final short

The constant used by TAG_CONTRAST to denote soft contrast.

static final int

The constant used by TAG_COMPRESSION, see DNG Specification 1.4.0.0.

static final int

The constant used by TAG_COMPRESSION to denote the image is huffman compressed.

static final int

The constant used by TAG_COMPRESSION to denote the image is JPEG.

static final int

The constant used by TAG_COMPRESSION, see DNG Specification 1.4.0.0.

static final int

The constant used by TAG_COMPRESSION, see DNG Specification 1.4.0.0.

static final int

The constant used by TAG_COMPRESSION to denote the image is pack-bits compressed.

static final int

The constant used by TAG_COMPRESSION to denote the image is not compressed.

static final short

The constant used by TAG_EXPOSURE_MODE to denote the exposure mode is Auto.

static final short

The constant used by TAG_EXPOSURE_MODE to denote the exposure mode is Auto bracket.

static final short

The constant used by TAG_EXPOSURE_MODE to denote the exposure mode is Manual.

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is Action program (biased toward fast shutter speed).

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is Aperture priority.

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is Creative program (biased toward depth of field).

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is Landscape mode (for landscape photos with the background in focus).

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is Manual.

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is Normal.

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is not defined.

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is Portrait mode (for closeup photos with the background out of focus).

static final short

The constant used by TAG_EXPOSURE_PROGRAM to denote exposure program is Shutter priority.

static final short

The constant used by TAG_FILE_SOURCE to denote the source is DSC.

static final short

The constant used by TAG_FILE_SOURCE to denote the source is other.

static final short

The constant used by TAG_FILE_SOURCE to denote the source is scanner of reflex type.

static final short

The constant used by TAG_FILE_SOURCE to denote the source is scanner of transparent type.

static final short

The flag used by TAG_FLASH to indicate whether the flash is fired.

static final short

The flag used by TAG_FLASH to indicate the camera's flash mode is Auto.

static final short

The flag used by TAG_FLASH to indicate the camera's flash mode is Compulsory flash firing.

static final short

The flag used by TAG_FLASH to indicate the camera's flash mode is Compulsory flash suppression.

static final short

The flag used by TAG_FLASH to indicate no flash function is present.

static final short

The flag used by TAG_FLASH to indicate red-eye reduction is supported.

static final short

The flag used by TAG_FLASH to indicate strobe return light is detected.

static final short

The flag used by TAG_FLASH to indicate strobe return light is not detected.

static final short

The constant used by TAG_PLANAR_CONFIGURATION to denote Chunky format.

static final short

The constant used by TAG_PLANAR_CONFIGURATION to denote Planar format.

static final short

The constant used by TAG_GAIN_CONTROL to denote high gain down.

static final short

The constant used by TAG_GAIN_CONTROL to denote high gain up.

static final short

The constant used by TAG_GAIN_CONTROL to denote low gain down.

static final short

The constant used by TAG_GAIN_CONTROL to denote low gain up.

static final short

The constant used by TAG_GAIN_CONTROL to denote none gain adjustment.

static final String

The constant used by GPS attributes to denote the direction is magnetic direction.

static final String

The constant used by GPS attributes to denote the direction is true direction.

static final String

The constant used by TAG_GPS_DEST_DISTANCE_REF to denote the distance unit is kilometers.

static final String

The constant used by TAG_GPS_DEST_DISTANCE_REF to denote the distance unit is miles.

static final String

The constant used by TAG_GPS_DEST_DISTANCE_REF to denote the distance unit is nautical miles.

static final String

The constant used by TAG_GPS_MEASURE_MODE to denote GPS measurement is 2-dimensional.

static final String

The constant used by TAG_GPS_MEASURE_MODE to denote GPS measurement is 3-dimensional.

static final short

The constant used by TAG_GPS_DIFFERENTIAL to denote differential correction is applied.

static final String

The constant used by TAG_GPS_STATUS to denote GPS measurement is interrupted.

static final String

The constant used by TAG_GPS_STATUS to denote GPS measurement is in progress.

static final short

The constant used by TAG_GPS_DIFFERENTIAL to denote no differential correction is applied.

static final String

The constant used by TAG_GPS_SPEED_REF to denote the speed unit is kilometers per hour.

static final String

The constant used by TAG_GPS_SPEED_REF to denote the speed unit is knots.

static final String

The constant used by TAG_GPS_SPEED_REF to denote the speed unit is miles per hour.

static final String

The constant used by GPS latitude-related tags to denote the latitude is North latitude.

static final String

The constant used by GPS latitude-related tags to denote the latitude is South latitude.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Cloudy weather.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Cool white fluorescent (W 3800 - 4500K).

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is D50.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is D55.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is D65.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is D75.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Daylight.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Daylight fluorescent (D 5700 - 7100K).

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Day white fluorescent (N 4600 - 5500K).

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Fine weather.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Flash.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Fluorescent.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is ISO studio tungsten.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is other.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Shade.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Standard light A.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Standard light B.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Standard light C.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Tungsten (incandescent light).

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is unknown.

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is Warm white fluorescent (L 2600 - 3250K).

static final short

The constant used by TAG_LIGHT_SOURCE to denote light source is White fluorescent (WW 3250 - 3800K).

static final String

The constant used by GPS longitude-related tags to denote the longitude is East longitude.

static final String

The constant used by GPS longitude-related tags to denote the longitude is West longitude.

static final short

The constant used by TAG_METERING_MODE to denote metering mode is Average.

static final short

The constant used by TAG_METERING_MODE to denote metering mode is CenterWeightedAverage.

static final short

The constant used by TAG_METERING_MODE to denote metering mode is MultiSpot.

static final short

The constant used by TAG_METERING_MODE to denote metering mode is other.

static final short

The constant used by TAG_METERING_MODE to denote metering mode is Partial.

static final short

The constant used by TAG_METERING_MODE to denote metering mode is Pattern.

static final short

The constant used by TAG_METERING_MODE to denote metering mode is Spot.

static final short

The constant used by TAG_METERING_MODE to denote metering mode is unknown.

static final int

Indicates the image is left right reversed mirror.

static final int

Indicates the image is upside down mirror, it can also be represented by flip horizontally firstly and rotate 180 degree clockwise.

static final int
static final int

Indicates the image is rotated by 180 degree clockwise.

static final int

Indicates the image is rotated by 270 degree clockwise.

static final int

Indicates the image is rotated by 90 degree clockwise.

static final int

Indicates the image is flipped about top-left <--> bottom-right axis, it can also be represented by flip horizontally firstly and rotate 270 degree clockwise.

static final int

Indicates the image is flipped about top-right <--> bottom-left axis, it can also be represented by flip horizontally firstly and rotate 90 degree clockwise.

static final int
static final int

The constant used by TAG_NEW_SUBFILE_TYPE.

static final int

The constant used by TAG_PHOTOMETRIC_INTERPRETATION.

static final int

The constant used by TAG_PHOTOMETRIC_INTERPRETATION.

static final int

The constant used by TAG_PHOTOMETRIC_INTERPRETATION.

static final int

The constant used by TAG_PHOTOMETRIC_INTERPRETATION.

static final int

The constant used by TAG_NEW_SUBFILE_TYPE.

static final short

The constant used by TAG_CUSTOM_RENDERED to denote special processing is used.

static final short

The constant used by TAG_CUSTOM_RENDERED to denote no special processing is used.

static final short

The constant used to denote resolution unit as centimeters.

static final short

The constant used to denote resolution unit as inches.

static final short

The constant used by TAG_SHARPNESS to denote high saturation.

static final short

The constant used by TAG_SATURATION to denote low saturation.

static final short

The constant used by TAG_SATURATION to denote normal saturation.

static final short

The constant used by TAG_SCENE_CAPTURE_TYPE to denote the scene capture type is Landscape.

static final short

The constant used by TAG_SCENE_CAPTURE_TYPE to denote the scene capture type is Night scene.

static final short

The constant used by TAG_SCENE_CAPTURE_TYPE to denote the scene capture type is Portrait.

static final short

The constant used by TAG_SCENE_CAPTURE_TYPE to denote the scene capture type is Standard.

static final short

The constant used by TAG_SCENE_TYPE to denote the scene is directly photographed.

static final short

The constant used by TAG_SENSITIVITY_TYPE to denote sensitivity type is ISO speed.

static final short

The constant used by TAG_SENSITIVITY_TYPE to denote sensitivity type is Recommended exposure index (REI).

static final short

The constant used by TAG_SENSITIVITY_TYPE to denote sensitivity type is Recommended exposure index (REI) and ISO speed.

static final short

The constant used by TAG_SENSITIVITY_TYPE to denote sensitivity type is Standard output sensitivity (SOS).

static final short

The constant used by TAG_SENSITIVITY_TYPE to denote sensitivity type is Standard output sensitivity (SOS) and ISO speed.

static final short

The constant used by TAG_SENSITIVITY_TYPE to denote sensitivity type is Standard output sensitivity (SOS) and recommended exposure index (REI).

static final short

The constant used by TAG_SENSITIVITY_TYPE to denote sensitivity type is Standard output sensitivity (SOS) and recommended exposure index (REI) and ISO speed.

static final short

The constant used by TAG_SENSITIVITY_TYPE to denote sensitivity type is unknown.