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.

static final short

The constant used by TAG_SENSING_METHOD to denote the image sensor type is Color sequential area sensor.

static final short

The constant used by TAG_SENSING_METHOD to denote the image sensor type is Color sequential linear sensor.

static final short

The constant used by TAG_SENSING_METHOD to denote the image sensor type is not defined.

static final short

The constant used by TAG_SENSING_METHOD to denote the image sensor type is One-chip color area sensor.

static final short

The constant used by TAG_SENSING_METHOD to denote the image sensor type is Three-chip color area sensor.

static final short

The constant used by TAG_SENSING_METHOD to denote the image sensor type is Trilinear sensor.

static final short

The constant used by TAG_SENSING_METHOD to denote the image sensor type is Two-chip color area sensor.

static final short

The constant used by TAG_SHARPNESS to denote hard sharpness.

static final short

The constant used by TAG_SHARPNESS to denote normal sharpness.

static final short

The constant used by TAG_SHARPNESS to denote soft sharpness.

static final int

Constant used to indicate that the input stream contains only Exif data.

static final int

Constant used to indicate that the input stream contains the full image data.

static final short

The constant used by TAG_SUBJECT_DISTANCE_RANGE to denote the subject distance range is Close view.

static final short

The constant used by TAG_SUBJECT_DISTANCE_RANGE to denote the subject distance range is Distant view.

static final short

The constant used by TAG_SUBJECT_DISTANCE_RANGE to denote the subject distance range is Macro.

static final short

The constant used by TAG_SUBJECT_DISTANCE_RANGE to denote the subject distance range is unknown.

static final String
TAG_APERTURE_VALUE = "ApertureValue"

The lens aperture.

static final String
TAG_ARTIST = "Artist"

This tag records the name of the camera owner, photographer or image creator.

static final String
TAG_BITS_PER_SAMPLE = "BitsPerSample"

The number of bits per image component.

static final String
TAG_BODY_SERIAL_NUMBER = "BodySerialNumber"

This tag records the serial number of the body of the camera that was used in photography as an ASCII string.

static final String
TAG_BRIGHTNESS_VALUE = "BrightnessValue"

The value of brightness.

static final String
TAG_CAMARA_OWNER_NAME = "CameraOwnerName"

This field is deprecated.

Use TAG_CAMERA_OWNER_NAME instead.

static final String
TAG_CAMERA_OWNER_NAME = "CameraOwnerName"

This tag records the owner of a camera used in photography as an ASCII string.

static final String
TAG_CFA_PATTERN = "CFAPattern"

Indicates the color filter array (CFA) geometric pattern of the image sensor when a one-chip color area sensor is used.

static final String
TAG_COLOR_SPACE = "ColorSpace"

The color space information tag is always recorded as the color space specifier.

static final String
TAG_COMPONENTS_CONFIGURATION = "ComponentsConfiguration"

Information specific to compressed data.

static final String
TAG_COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel"

Information specific to compressed data.

static final String
TAG_COMPRESSION = "Compression"

The compression scheme used for the image data.

static final String
TAG_CONTRAST = "Contrast"

This tag indicates the direction of contrast processing applied by the camera when the image was shot.

static final String
TAG_COPYRIGHT = "Copyright"

Copyright information.

static final String
TAG_CUSTOM_RENDERED = "CustomRendered"

This tag indicates the use of special processing on image data, such as rendering geared to output.

static final String
TAG_DATETIME = "DateTime"

The date and time of image creation.

static final String
TAG_DATETIME_DIGITIZED = "DateTimeDigitized"

The date and time when the image was stored as digital data.

static final String
TAG_DATETIME_ORIGINAL = "DateTimeOriginal"

The date and time when the original image data was generated.

static final String
TAG_DEFAULT_CROP_SIZE = "DefaultCropSize"

Type is int.

static final String
TAG_DEVICE_SETTING_DESCRIPTION = "DeviceSettingDescription"

This tag indicates information on the picture-taking conditions of a particular camera model.

static final String
TAG_DIGITAL_ZOOM_RATIO = "DigitalZoomRatio"

This tag indicates the digital zoom ratio when the image was shot.

static final String
TAG_DNG_VERSION = "DNGVersion"

Type is int.

static final String
TAG_EXIF_VERSION = "ExifVersion"

The version of this standard supported.

static final String
TAG_EXPOSURE_BIAS_VALUE = "ExposureBiasValue"

The exposure bias.

static final String
TAG_EXPOSURE_INDEX = "ExposureIndex"

Indicates the exposure index selected on the camera or input device at the time the image is captured.

static final String
TAG_EXPOSURE_MODE = "ExposureMode"

This tag indicates the exposure mode set when the image was shot.

static final String
TAG_EXPOSURE_PROGRAM = "ExposureProgram"

The class of the program used by the camera to set exposure when the picture is taken.

static final String
TAG_EXPOSURE_TIME = "ExposureTime"

Exposure time, given in seconds.

static final String
TAG_FILE_SOURCE = "FileSource"

Indicates the image source.

static final String
TAG_FLASH = "Flash"

This tag indicates the status of flash when the image was shot.

static final String
TAG_FLASHPIX_VERSION = "FlashpixVersion"

The Flashpix format version supported by a FPXR file.

static final String
TAG_FLASH_ENERGY = "FlashEnergy"

Indicates the strobe energy at the time the image is captured, as measured in Beam Candle Power Seconds (BCPS).

static final String
TAG_FOCAL_LENGTH = "FocalLength"

The actual focal length of the lens, in mm.

static final String
TAG_FOCAL_LENGTH_IN_35MM_FILM = "FocalLengthIn35mmFilm"

This tag indicates the equivalent focal length assuming a 35mm film camera, in mm.

static final String
TAG_FOCAL_PLANE_RESOLUTION_UNIT = "FocalPlaneResolutionUnit"

Indicates the unit for measuring TAG_FOCAL_PLANE_X_RESOLUTION and TAG_FOCAL_PLANE_Y_RESOLUTION.

static final String
TAG_FOCAL_PLANE_X_RESOLUTION = "FocalPlaneXResolution"

Indicates the number of pixels in the image width (X) direction per TAG_FOCAL_PLANE_RESOLUTION_UNIT on the camera focal plane.

static final String
TAG_FOCAL_PLANE_Y_RESOLUTION = "FocalPlaneYResolution"

Indicates the number of pixels in the image height (Y) direction per TAG_FOCAL_PLANE_RESOLUTION_UNIT on the camera focal plane.

static final String
TAG_F_NUMBER = "FNumber"

The F number.

static final String
TAG_GAIN_CONTROL = "GainControl"

This tag indicates the degree of overall image gain adjustment.

static final String
TAG_GAMMA = "Gamma"

Indicates the value of coefficient gamma.

static final String
TAG_GPS_ALTITUDE = "GPSAltitude"

Indicates the altitude based on the reference in TAG_GPS_ALTITUDE_REF.

static final String
TAG_GPS_ALTITUDE_REF = "GPSAltitudeRef"

Indicates the altitude used as the reference altitude.</