ExifInterface
open class ExifInterface
kotlin.Any | |
↳ | android.media.ExifInterface |
This is a class for reading and writing Exif tags in various image file formats.
Note: This class has known issues on some versions of Android. It is recommended to use the AndroidX ExifInterface Library since it offers a superset of the functionality of this class and is more easily updateable. In addition to the functionality of this class, it supports parsing extra metadata such as exposure and data compression information as well as setting extra metadata such as GPS and datetime information.
Supported for reading: JPEG, PNG, WebP, HEIF, DNG, CR2, NEF, NRW, ARW, RW2, ORF, PEF, SRW, RAF, AVIF.
Supported for writing: JPEG, PNG, WebP.
Note: JPEG and HEIF files may contain XMP data either inside the Exif data chunk or outside of it. This class will search both locations for XMP data, but if XMP data exist both inside and outside Exif, will favor the XMP data inside Exif over the one outside.
Summary
Constants | |
---|---|
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int | |
static Int |
Constant used to indicate that the input stream contains only Exif data. |
static Int |
Constant used to indicate that the input stream contains the full image data. |
static String |
Type is double. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is double. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is double. |
static String |
Type is rational. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is double. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is rational. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is rational. |
static String |
Type is rational. |
static String |
Type is double. |
static String |
Type is int. |
static String |
The altitude (in meters) based on the reference in TAG_GPS_ALTITUDE_REF. |
static String |
0 if the altitude is above sea level. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is rational. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is rational. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is String. |
static String |
A tag used to record the offset from UTC (the time difference from Universal Time Coordinated including daylight saving time) of the time of DateTime tag. |
static String |
A tag used to record the offset from UTC (the time difference from Universal Time Coordinated including daylight saving time) of the time of DateTimeDigitized tag. |
static String |
A tag used to record the offset from UTC (the time difference from Universal Time Coordinated including daylight saving time) of the time of DateTimeOriginal tag. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is undefined. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is rational. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is undefined. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is rational. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is double. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is String. |
static String |
Type is int. |
static String |
Type is rational. |
static String |
Type is byte[]. |
static String |
Type is rational. |
static String |
Type is rational. |
static String |
Type is int. |
static String |
Type is int. |
static String |
Type is rational. |
static Int | |
static Int |
Public constructors | |
---|---|
ExifInterface(file: File) Reads Exif tags from the specified image file. |
|
ExifInterface(fileDescriptor: FileDescriptor) Reads Exif tags from the specified image file descriptor. |
|
ExifInterface(inputStream: InputStream) Reads Exif tags from the specified image input stream. |
|
ExifInterface(inputStream: InputStream, streamType: Int) Reads Exif tags from the specified image input stream based on the stream type. |
|
ExifInterface(filename: String) Reads Exif tags from the specified image file. |
Public methods | |
---|---|
open Double |
getAltitude(defaultValue: Double) Return the altitude in meters. |
open String? |
getAttribute(tag: String) Returns the value of the specified tag or |
open ByteArray? |
getAttributeBytes(tag: String) Returns the raw bytes for the value of the requested tag inside the image file, or |
open Double |
getAttributeDouble(tag: String, defaultValue: Double) Returns the double value of the tag that is specified as rational or contains a double-formatted value. |
open Int |
getAttributeInt(tag: String, defaultValue: Int) Returns the integer value of the specified tag. |
open LongArray? |
getAttributeRange(tag: String) Returns the offset and length of the requested tag inside the image file, or |
open Long |
Returns parsed |
open Long |
Returns parsed |
open Long |
Returns parsed |
open Long |
Returns number of milliseconds since Jan. |
open Boolean |
getLatLong(output: FloatArray!) Stores the latitude and longitude value in a float array. |
open ByteArray! |
Returns the JPEG compressed thumbnail inside the image file, or |
open Bitmap! |
Creates and returns a Bitmap object of the thumbnail image based on the byte array and the thumbnail compression value, or |
open ByteArray! |
Returns the thumbnail bytes inside the image file, regardless of the compression type of the thumbnail image. |
open LongArray? |
Returns the offset and length of thumbnail inside the image file, or |
open Boolean |
hasAttribute(tag: String) Returns true if the image file has the given attribute defined. |
open Boolean |
Returns true if the image file has a thumbnail. |
open static Boolean |
isSupportedMimeType(mimeType: String) Returns whether ExifInterface currently supports reading data from the specified mime type or not. |
open Boolean |
Returns true if thumbnail image is JPEG Compressed, or false if either thumbnail image does not exist or thumbnail image is uncompressed. |
open Unit |
Save the tag data into the original image file. |
open Unit |
setAttribute(tag: String, value: String?) Set the value of the specified tag. |
Constants
ORIENTATION_FLIP_HORIZONTAL
static val ORIENTATION_FLIP_HORIZONTAL: Int
Value: 2
STREAM_TYPE_EXIF_DATA_ONLY
static val STREAM_TYPE_EXIF_DATA_ONLY: Int
Constant used to indicate that the input stream contains only Exif data.
The format of the Exif-only data must follow the below structure: Exif Identifier Code ("Exif\0\0") + TIFF header + IFD data See JEITA CP-3451C Section 4.5.2 and 4.5.4 specifications for more details.
Value: 1
STREAM_TYPE_FULL_IMAGE_DATA
static val STREAM_TYPE_FULL_IMAGE_DATA: Int
Constant used to indicate that the input stream contains the full image data.
The format of the image data should follow one of the image formats supported by this class.
Value: 0
TAG_APERTURE
static valTAG_APERTURE: String
Deprecated: use TAG_F_NUMBER
instead
Type is double.
Value: "FNumber"
TAG_APERTURE_VALUE
static val TAG_APERTURE_VALUE: String
Type is rational.
Value: "ApertureValue"
TAG_BITS_PER_SAMPLE
static val TAG_BITS_PER_SAMPLE: String
Type is int.
Value: "BitsPerSample"
TAG_BRIGHTNESS_VALUE
static val TAG_BRIGHTNESS_VALUE: String
Type is rational.
Value: "BrightnessValue"
TAG_CFA_PATTERN
static val TAG_CFA_PATTERN: String
Type is String.
Value: "CFAPattern"
TAG_COLOR_SPACE
static val TAG_COLOR_SPACE: String
Type is int.
Value: "ColorSpace"
TAG_COMPONENTS_CONFIGURATION
static val TAG_COMPONENTS_CONFIGURATION: String
Type is String.
Value: "ComponentsConfiguration"
TAG_COMPRESSED_BITS_PER_PIXEL
static val TAG_COMPRESSED_BITS_PER_PIXEL: String
Type is rational.
Value: "CompressedBitsPerPixel"
TAG_COMPRESSION
static val TAG_COMPRESSION: String
Type is int.
Value: "Compression"
TAG_COPYRIGHT
static val TAG_COPYRIGHT: String
Type is String.
Value: "Copyright"
TAG_CUSTOM_RENDERED
static val TAG_CUSTOM_RENDERED: String
Type is int.
Value: "CustomRendered"
TAG_DATETIME_DIGITIZED
static val TAG_DATETIME_DIGITIZED: String
Type is String.
Value: "DateTimeDigitized"
TAG_DATETIME_ORIGINAL
static val TAG_DATETIME_ORIGINAL: String
Type is String.
Value: "DateTimeOriginal"
TAG_DEFAULT_CROP_SIZE
static val TAG_DEFAULT_CROP_SIZE: String
Type is int. DNG Specification 1.4.0.0. Section 4
Value: "DefaultCropSize"
TAG_DEVICE_SETTING_DESCRIPTION
static val TAG_DEVICE_SETTING_DESCRIPTION: String
Type is String.
Value: "DeviceSettingDescription"
TAG_DIGITAL_ZOOM_RATIO
static val TAG_DIGITAL_ZOOM_RATIO: String
Type is double.
Value: "DigitalZoomRatio"
TAG_DNG_VERSION
static val TAG_DNG_VERSION: String
Type is int. DNG Specification 1.4.0.0. Section 4
Value: "DNGVersion"
TAG_EXIF_VERSION
static val TAG_EXIF_VERSION: String
Type is String.
Value: "ExifVersion"
TAG_EXPOSURE_BIAS_VALUE
static val TAG_EXPOSURE_BIAS_VALUE: String
Type is double.
Value: "ExposureBiasValue"
TAG_EXPOSURE_INDEX
static val TAG_EXPOSURE_INDEX: String
Type is rational.
Value: "ExposureIndex"
TAG_EXPOSURE_MODE
static val TAG_EXPOSURE_MODE: String
Type is int.
Value: "ExposureMode"
TAG_EXPOSURE_PROGRAM
static val TAG_EXPOSURE_PROGRAM: String
Type is int.
Value: "ExposureProgram"
TAG_EXPOSURE_TIME
static val TAG_EXPOSURE_TIME: String
Type is double.
Value: "ExposureTime"
TAG_FILE_SOURCE
static val TAG_FILE_SOURCE: String
Type is String.
Value: "FileSource"
TAG_FLASHPIX_VERSION
static val TAG_FLASHPIX_VERSION: String
Type is String.
Value: "FlashpixVersion"
TAG_FLASH_ENERGY
static val TAG_FLASH_ENERGY: String
Type is rational.
Value: "FlashEnergy"
TAG_FOCAL_LENGTH
static val TAG_FOCAL_LENGTH: String
Type is rational.
Value: "FocalLength"
TAG_FOCAL_LENGTH_IN_35MM_FILM
static val TAG_FOCAL_LENGTH_IN_35MM_FILM: String
Type is int.
Value: "FocalLengthIn35mmFilm"
TAG_FOCAL_PLANE_RESOLUTION_UNIT
static val TAG_FOCAL_PLANE_RESOLUTION_UNIT: String
Type is int.
Value: "FocalPlaneResolutionUnit"
TAG_FOCAL_PLANE_X_RESOLUTION
static val TAG_FOCAL_PLANE_X_RESOLUTION: String
Type is rational.
Value: "FocalPlaneXResolution"
TAG_FOCAL_PLANE_Y_RESOLUTION
static val TAG_FOCAL_PLANE_Y_RESOLUTION: String
Type is rational.
Value: "FocalPlaneYResolution"
TAG_GAIN_CONTROL
static val TAG_GAIN_CONTROL: String
Type is int.
Value: "GainControl"
TAG_GPS_ALTITUDE
static val TAG_GPS_ALTITUDE: String
The altitude (in meters) based on the reference in TAG_GPS_ALTITUDE_REF. Type is rational.
Value: "GPSAltitude"
TAG_GPS_ALTITUDE_REF
static val TAG_GPS_ALTITUDE_REF: String
0 if the altitude is above sea level. 1 if the altitude is below sea level. Type is int.
Value: "GPSAltitudeRef"
TAG_GPS_AREA_INFORMATION
static val TAG_GPS_AREA_INFORMATION: String
Type is String.
Value: "GPSAreaInformation"
TAG_GPS_DATESTAMP
static val TAG_GPS_DATESTAMP: String
Type is String.
Value: "GPSDateStamp"
TAG_GPS_DEST_BEARING
static val TAG_GPS_DEST_BEARING: String
Type is rational.
Value: "GPSDestBearing"
TAG_GPS_DEST_BEARING_REF
static val TAG_GPS_DEST_BEARING_REF: String
Type is String.
Value: "GPSDestBearingRef"
TAG_GPS_DEST_DISTANCE
static val TAG_GPS_DEST_DISTANCE: String
Type is rational.
Value: "GPSDestDistance"
TAG_GPS_DEST_DISTANCE_REF
static val TAG_GPS_DEST_DISTANCE_REF: String
Type is String.
Value: "GPSDestDistanceRef"
TAG_GPS_DEST_LATITUDE
static val TAG_GPS_DEST_LATITUDE: String
Type is rational.
Value: "GPSDestLatitude"
TAG_GPS_DEST_LATITUDE_REF
static val TAG_GPS_DEST_LATITUDE_REF: String
Type is String.
Value: "GPSDestLatitudeRef"
TAG_GPS_DEST_LONGITUDE
static val TAG_GPS_DEST_LONGITUDE: String
Type is rational.
Value: "GPSDestLongitude"
TAG_GPS_DEST_LONGITUDE_REF
static val TAG_GPS_DEST_LONGITUDE_REF: String
Type is String.
Value: "GPSDestLongitudeRef"
TAG_GPS_DIFFERENTIAL
static val TAG_GPS_DIFFERENTIAL: String
Type is int.
Value: "GPSDifferential"
TAG_GPS_IMG_DIRECTION
static val TAG_GPS_IMG_DIRECTION: String
Type is rational.
Value: "GPSImgDirection"
TAG_GPS_IMG_DIRECTION_REF
static val TAG_GPS_IMG_DIRECTION_REF: String
Type is String.
Value: "GPSImgDirectionRef"
TAG_GPS_LATITUDE
static val TAG_GPS_LATITUDE: String
Type is rational. Format is "num1/denom1,num2/denom2,num3/denom3".
Value: "GPSLatitude"
TAG_GPS_LATITUDE_REF
static val TAG_GPS_LATITUDE_REF: String
Type is String.
Value: "GPSLatitudeRef"
TAG_GPS_LONGITUDE
static val TAG_GPS_LONGITUDE: String
Type is rational. Format is "num1/denom1,num2/denom2,num3/denom3".
Value: "GPSLongitude"
TAG_GPS_LONGITUDE_REF
static val TAG_GPS_LONGITUDE_REF: String
Type is String.
Value: "GPSLongitudeRef"
TAG_GPS_MAP_DATUM
static val TAG_GPS_MAP_DATUM: String
Type is String.
Value: "GPSMapDatum"
TAG_GPS_MEASURE_MODE
static val TAG_GPS_MEASURE_MODE: String
Type is String.
Value: "GPSMeasureMode"
TAG_GPS_PROCESSING_METHOD
static val TAG_GPS_PROCESSING_METHOD: String
Type is String. Name of GPS processing method used for location finding.
Value: "GPSProcessingMethod"
TAG_GPS_SATELLITES
static val TAG_GPS_SATELLITES: String
Type is String.
Value: "GPSSatellites"
TAG_GPS_SPEED
static val TAG_GPS_SPEED: String
Type is rational.
Value: "GPSSpeed"
TAG_GPS_SPEED_REF
static val TAG_GPS_SPEED_REF: String
Type is String.
Value: "GPSSpeedRef"
TAG_GPS_STATUS
static val TAG_GPS_STATUS: String
Type is String.
Value: "GPSStatus"
TAG_GPS_TIMESTAMP
static val TAG_GPS_TIMESTAMP: String
Type is String. Format is "hh:mm:ss".
Value: "GPSTimeStamp"
TAG_GPS_TRACK
static val TAG_GPS_TRACK: String
Type is rational.
Value: "GPSTrack"
TAG_GPS_TRACK_REF
static val TAG_GPS_TRACK_REF: String
Type is String.
Value: "GPSTrackRef"
TAG_GPS_VERSION_ID
static val TAG_GPS_VERSION_ID: String
Type is String.
Value: "GPSVersionID"
TAG_IMAGE_DESCRIPTION
static val TAG_IMAGE_DESCRIPTION: String
Type is String.
Value: "ImageDescription"
TAG_IMAGE_LENGTH
static val TAG_IMAGE_LENGTH: String
Type is int.
Value: "ImageLength"
TAG_IMAGE_UNIQUE_ID
static val TAG_IMAGE_UNIQUE_ID: String
Type is String.
Value: "ImageUniqueID"
TAG_IMAGE_WIDTH
static val TAG_IMAGE_WIDTH: String
Type is int.
Value: "ImageWidth"
TAG_INTEROPERABILITY_INDEX
static val TAG_INTEROPERABILITY_INDEX: String
Type is String.
Value: "InteroperabilityIndex"
TAG_ISO
static valTAG_ISO: String
Deprecated: use TAG_ISO_SPEED_RATINGS
instead
Type is int.
Value: "ISOSpeedRatings"
TAG_ISO_SPEED_RATINGS
static val TAG_ISO_SPEED_RATINGS: String
Type is int.
Value: "ISOSpeedRatings"
TAG_JPEG_INTERCHANGE_FORMAT
static val TAG_JPEG_INTERCHANGE_FORMAT: String
Type is int.
Value: "JPEGInterchangeFormat"
TAG_JPEG_INTERCHANGE_FORMAT_LENGTH
static val TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: String
Type is int.
Value: "JPEGInterchangeFormatLength"
TAG_LIGHT_SOURCE
static val TAG_LIGHT_SOURCE: String
Type is int.
Value: "LightSource"
TAG_MAKER_NOTE
static val TAG_MAKER_NOTE: String
Type is String.
Value: "MakerNote"
TAG_MAX_APERTURE_VALUE
static val TAG_MAX_APERTURE_VALUE: String
Type is rational.
Value: "MaxApertureValue"
TAG_METERING_MODE
static val TAG_METERING_MODE: String
Type is int.
Value: "MeteringMode"
TAG_NEW_SUBFILE_TYPE
static val TAG_NEW_SUBFILE_TYPE: String
Type is int.
Value: "NewSubfileType"
TAG_OFFSET_TIME
static val TAG_OFFSET_TIME: String
A tag used to record the offset from UTC (the time difference from Universal Time Coordinated including daylight saving time) of the time of DateTime tag. The format when recording the offset is "±HH:MM". The part of "±" shall be recorded as "+" or "-". When the offsets are unknown, all the character spaces except colons (":") should be filled with blank characters, or else the Interoperability field should be filled with blank characters. The character string length is 7 Bytes including NULL for termination. When the field is left blank, it is treated as unknown.
- Tag = 36880
- Type = String
- Length = 7
- Default = None
Value: "OffsetTime"
TAG_OFFSET_TIME_DIGITIZED
static val TAG_OFFSET_TIME_DIGITIZED: String
A tag used to record the offset from UTC (the time difference from Universal Time Coordinated including daylight saving time) of the time of DateTimeDigitized tag. The format when recording the offset is "±HH:MM". The part of "±" shall be recorded as "+" or "-". When the offsets are unknown, all the character spaces except colons (":") should be filled with blank characters, or else the Interoperability field should be filled with blank characters. The character string length is 7 Bytes including NULL for termination. When the field is left blank, it is treated as unknown.
- Tag = 36882
- Type = String
- Length = 7
- Default = None
Value: "OffsetTimeDigitized"
TAG_OFFSET_TIME_ORIGINAL
static val TAG_OFFSET_TIME_ORIGINAL: String
A tag used to record the offset from UTC (the time difference from Universal Time Coordinated including daylight saving time) of the time of DateTimeOriginal tag. The format when recording the offset is "±HH:MM". The part of "±" shall be recorded as "+" or "-". When the offsets are unknown, all the character spaces except colons (":") should be filled with blank characters, or else the Interoperability field should be filled with blank characters. The character string length is 7 Bytes including NULL for termination. When the field is left blank, it is treated as unknown.
- Tag = 36881
- Type = String
- Length = 7
- Default = None
Value: "OffsetTimeOriginal"
TAG_ORF_ASPECT_FRAME
static val TAG_ORF_ASPECT_FRAME: String
Type is int. See Olympus Image Processing tags in http://www.exiv2.org/tags-olympus.html.
Value: "AspectFrame"
TAG_ORF_PREVIEW_IMAGE_LENGTH
static val TAG_ORF_PREVIEW_IMAGE_LENGTH: String
Type is int. See Olympus Camera Settings tags in http://www.exiv2.org/tags-olympus.html.
Value: "PreviewImageLength"
TAG_ORF_PREVIEW_IMAGE_START
static val TAG_ORF_PREVIEW_IMAGE_START: String
Type is int. See Olympus Camera Settings tags in http://www.exiv2.org/tags-olympus.html.
Value: "PreviewImageStart"
TAG_ORF_THUMBNAIL_IMAGE
static val TAG_ORF_THUMBNAIL_IMAGE: String
Type is undefined. See Olympus MakerNote tags in http://www.exiv2.org/tags-olympus.html.
Value: "ThumbnailImage"
TAG_ORIENTATION
static val TAG_ORIENTATION: String
Type is int.
Value: "Orientation"
TAG_PHOTOMETRIC_INTERPRETATION
static val TAG_PHOTOMETRIC_INTERPRETATION: String
Type is int.
Value: "PhotometricInterpretation"
TAG_PIXEL_X_DIMENSION
static val TAG_PIXEL_X_DIMENSION: String
Type is int.
Value: "PixelXDimension"
TAG_PIXEL_Y_DIMENSION
static val TAG_PIXEL_Y_DIMENSION: String
Type is int.
Value: "PixelYDimension"
TAG_PLANAR_CONFIGURATION
static val TAG_PLANAR_CONFIGURATION: String
Type is int.
Value: "PlanarConfiguration"
TAG_PRIMARY_CHROMATICITIES
static val TAG_PRIMARY_CHROMATICITIES: String
Type is rational.
Value: "PrimaryChromaticities"
TAG_REFERENCE_BLACK_WHITE
static val TAG_REFERENCE_BLACK_WHITE: String
Type is rational.
Value: "ReferenceBlackWhite"
TAG_RELATED_SOUND_FILE
static val TAG_RELATED_SOUND_FILE: String
Type is String.
Value: "RelatedSoundFile"
TAG_RESOLUTION_UNIT
static val TAG_RESOLUTION_UNIT: String
Type is int.
Value: "ResolutionUnit"
TAG_ROWS_PER_STRIP
static val TAG_ROWS_PER_STRIP: String
Type is int.
Value: "RowsPerStrip"
TAG_RW2_ISO
static val TAG_RW2_ISO: String
Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html
Value: "ISO"
TAG_RW2_JPG_FROM_RAW
static val TAG_RW2_JPG_FROM_RAW: String
Type is undefined. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html
Value: "JpgFromRaw"
TAG_RW2_SENSOR_BOTTOM_BORDER
static val TAG_RW2_SENSOR_BOTTOM_BORDER: String
Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html
Value: "SensorBottomBorder"
TAG_RW2_SENSOR_LEFT_BORDER
static val TAG_RW2_SENSOR_LEFT_BORDER: String
Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html
Value: "SensorLeftBorder"
TAG_RW2_SENSOR_RIGHT_BORDER
static val TAG_RW2_SENSOR_RIGHT_BORDER: String
Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html
Value: "SensorRightBorder"
TAG_RW2_SENSOR_TOP_BORDER
static val TAG_RW2_SENSOR_TOP_BORDER: String
Type is int. See PanasonicRaw tags in http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PanasonicRaw.html
Value: "SensorTopBorder"
TAG_SAMPLES_PER_PIXEL
static val TAG_SAMPLES_PER_PIXEL: String
Type is int.
Value: "SamplesPerPixel"
TAG_SATURATION
static val TAG_SATURATION: String
Type is int.
Value: "Saturation"
TAG_SCENE_CAPTURE_TYPE
static val TAG_SCENE_CAPTURE_TYPE: String
Type is int.
Value: "SceneCaptureType"
TAG_SCENE_TYPE
static val TAG_SCENE_TYPE: String
Type is String.
Value: "SceneType"
TAG_SENSING_METHOD
static val TAG_SENSING_METHOD: String
Type is int.
Value: "SensingMethod"
TAG_SHARPNESS
static val TAG_SHARPNESS: String
Type is int.
Value: "Sharpness"
TAG_SHUTTER_SPEED_VALUE
static val TAG_SHUTTER_SPEED_VALUE: String
Type is rational.
Value: "ShutterSpeedValue"
TAG_SOFTWARE
static val TAG_SOFTWARE: String
Type is String.
Value: "Software"
TAG_SPATIAL_FREQUENCY_RESPONSE
static val TAG_SPATIAL_FREQUENCY_RESPONSE: String
Type is String.
Value: "SpatialFrequencyResponse"
TAG_SPECTRAL_SENSITIVITY
static val TAG_SPECTRAL_SENSITIVITY: String
Type is String.
Value: "SpectralSensitivity"
TAG_STRIP_BYTE_COUNTS
static val TAG_STRIP_BYTE_COUNTS: String
Type is int.
Value: "StripByteCounts"
TAG_STRIP_OFFSETS
static val TAG_STRIP_OFFSETS: String
Type is int.
Value: "StripOffsets"
TAG_SUBFILE_TYPE
static val TAG_SUBFILE_TYPE: String
Type is int.
Value: "SubfileType"
TAG_SUBJECT_AREA
static val TAG_SUBJECT_AREA: String
Type is int.
Value: "SubjectArea"
TAG_SUBJECT_DISTANCE
static val TAG_SUBJECT_DISTANCE: String
Type is double.
Value: "SubjectDistance"
TAG_SUBJECT_DISTANCE_RANGE
static val TAG_SUBJECT_DISTANCE_RANGE: String
Type is int.
Value: "SubjectDistanceRange"
TAG_SUBJECT_LOCATION
static val TAG_SUBJECT_LOCATION: String
Type is int.
Value: "SubjectLocation"
TAG_SUBSEC_TIME
static val TAG_SUBSEC_TIME: String
Type is String.
Value: "SubSecTime"
TAG_SUBSEC_TIME_DIG
static valTAG_SUBSEC_TIME_DIG: String
Deprecated: use TAG_SUBSEC_TIME_DIGITIZED
instead
Type is String.
Value: "SubSecTimeDigitized"
TAG_SUBSEC_TIME_DIGITIZED
static val TAG_SUBSEC_TIME_DIGITIZED: String
Type is String.
Value: "SubSecTimeDigitized"
TAG_SUBSEC_TIME_ORIG
static valTAG_SUBSEC_TIME_ORIG: String
Deprecated: use TAG_SUBSEC_TIME_ORIGINAL
instead
Type is String.
Value: "SubSecTimeOriginal"
TAG_SUBSEC_TIME_ORIGINAL
static val TAG_SUBSEC_TIME_ORIGINAL: String
Type is String.
Value: "SubSecTimeOriginal"
TAG_THUMBNAIL_IMAGE_LENGTH
static val TAG_THUMBNAIL_IMAGE_LENGTH: String
Type is int.
Value: "ThumbnailImageLength"
TAG_THUMBNAIL_IMAGE_WIDTH
static val TAG_THUMBNAIL_IMAGE_WIDTH: String
Type is int.
Value: "ThumbnailImageWidth"
TAG_THUMBNAIL_ORIENTATION
static val TAG_THUMBNAIL_ORIENTATION: String
Type is int.
Value: "ThumbnailOrientation"
TAG_TRANSFER_FUNCTION
static val TAG_TRANSFER_FUNCTION: String
Type is int.
Value: "TransferFunction"
TAG_USER_COMMENT
static val TAG_USER_COMMENT: String
Type is String.
Value: "UserComment"
TAG_WHITE_BALANCE
static val TAG_WHITE_BALANCE: String
Type is int.
Value: "WhiteBalance"
TAG_WHITE_POINT
static val TAG_WHITE_POINT: String
Type is rational.
Value: "WhitePoint"
TAG_XMP
static val TAG_XMP: String
Type is byte[]. See Extensible Metadata Platform (XMP) for details on contents.
Value: "Xmp"
TAG_X_RESOLUTION
static val TAG_X_RESOLUTION: String
Type is rational.
Value: "XResolution"
TAG_Y_CB_CR_COEFFICIENTS
static val TAG_Y_CB_CR_COEFFICIENTS: String
Type is rational.
Value: "YCbCrCoefficients"
TAG_Y_CB_CR_POSITIONING
static val TAG_Y_CB_CR_POSITIONING: String
Type is int.
Value: "YCbCrPositioning"
TAG_Y_CB_CR_SUB_SAMPLING
static val TAG_Y_CB_CR_SUB_SAMPLING: String
Type is int.
Value: "YCbCrSubSampling"
TAG_Y_RESOLUTION
static val TAG_Y_RESOLUTION: String
Type is rational.
Value: "YResolution"
Public constructors
ExifInterface
ExifInterface(file: File)
Reads Exif tags from the specified image file.
Parameters | |
---|---|
file |
File: the file of the image data This value cannot be null . |
Exceptions | |
---|---|
java.lang.NullPointerException |
if file is null |
java.io.IOException |
if an I/O error occurs while retrieving file descriptor via FileInputStream.getFD() . |
ExifInterface
ExifInterface(fileDescriptor: FileDescriptor)
Reads Exif tags from the specified image file descriptor. Attribute mutation is supported for writable and seekable file descriptors only. This constructor will not rewind the offset of the given file descriptor. Developers should close the file descriptor after use.
Parameters | |
---|---|
fileDescriptor |
FileDescriptor: the file descriptor of the image data This value cannot be null . |
Exceptions | |
---|---|
java.lang.NullPointerException |
if file descriptor is null |
java.io.IOException |
if an error occurs while duplicating the file descriptor via Os.dup(FileDescriptor) . |
ExifInterface
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 from 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: the input stream that contains the image data This value cannot be null . |
Exceptions | |
---|---|
java.lang.NullPointerException |
if the input stream is null |
ExifInterface
ExifInterface(
inputStream: InputStream,
streamType: Int)
Reads Exif tags from the specified image input stream based on the stream type. Attribute mutation is not supported for input streams. The given input stream will proceed from 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: the input stream that contains the image data This value cannot be null . |
streamType |
Int: the type of input stream Value is android.media.ExifInterface#STREAM_TYPE_FULL_IMAGE_DATA , or android.media.ExifInterface#STREAM_TYPE_EXIF_DATA_ONLY |
Exceptions | |
---|---|
java.lang.NullPointerException |
if the input stream is null |
java.io.IOException |
if an I/O error occurs while retrieving file descriptor via FileInputStream.getFD() . |
ExifInterface
ExifInterface(filename: String)
Reads Exif tags from the specified image file.
Parameters | |
---|---|
filename |
String: the name of the file of the image data This value cannot be null . |
Exceptions | |
---|---|
java.lang.NullPointerException |
if file name is null |
java.io.IOException |
if an I/O error occurs while retrieving file descriptor via FileInputStream.getFD() . |
Public methods
getAltitude
open fun getAltitude(defaultValue: Double): Double
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. |
getAttribute
open fun getAttribute(tag: String): String?
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. This value cannot be null . |
getAttributeBytes
open fun getAttributeBytes(tag: String): ByteArray?
Returns the raw bytes for the value of the requested tag inside the image file, or null
if the tag is not contained.
Parameters | |
---|---|
tag |
String: This value cannot be null . |
Return | |
---|---|
ByteArray? |
raw bytes for the value of the requested tag, or null if no tag was found. |
getAttributeDouble
open fun getAttributeDouble(
tag: String,
defaultValue: Double
): Double
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. This value cannot be null . |
defaultValue |
Double: the value to return if the tag is not available. |
getAttributeInt
open fun getAttributeInt(
tag: String,
defaultValue: Int
): Int
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. This value cannot be null . |
defaultValue |
Int: the value to return if the tag is not available. |
getAttributeRange
open fun getAttributeRange(tag: String): LongArray?
Returns the offset and length of the requested tag inside the image file, or null
if the tag is not contained.
Parameters | |
---|---|
tag |
String: This value cannot be null . |
Return | |
---|---|
LongArray? |
two-element array, the offset in the first value, and length in the second, or null if no tag was found. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if saveAttributes() has been called since the underlying file was initially parsed, since that means offsets may have changed. |
getDateTime
open fun getDateTime(): Long
Returns parsed TAG_DATETIME
value, or -1 if unavailable or invalid.
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.
Return | |
---|---|
Long |
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z. |
getDateTimeDigitized
open fun getDateTimeDigitized(): Long
Returns parsed TAG_DATETIME_DIGITIZED
value, or -1 if unavailable or invalid.
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.
Return | |
---|---|
Long |
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z. |
getDateTimeOriginal
open fun getDateTimeOriginal(): Long
Returns parsed TAG_DATETIME_ORIGINAL
value, or -1 if unavailable or invalid.
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z.
Return | |
---|---|
Long |
Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z. |
getGpsDateTime
open fun getGpsDateTime(): Long
Returns number of milliseconds since Jan. 1, 1970, midnight UTC. Returns -1 if the date time information if not available.
getLatLong
open fun getLatLong(output: FloatArray!): Boolean
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.
getThumbnail
open fun getThumbnail(): ByteArray!
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 android.graphics.BitmapFactory#decodeByteArray(byte[],int,int)
getThumbnailBitmap
open fun getThumbnailBitmap(): Bitmap!
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.
getThumbnailBytes
open fun getThumbnailBytes(): ByteArray!
Returns the thumbnail bytes inside the image file, regardless of the compression type of the thumbnail image.
getThumbnailRange
open fun getThumbnailRange(): LongArray?
Returns the offset and length of thumbnail inside the image file, or null
if either there is no thumbnail or the thumbnail bytes are stored non-consecutively.
Return | |
---|---|
LongArray? |
two-element array, the offset in the first value, and length in the second, or null if no thumbnail was found or the thumbnail strips are not placed consecutively. |
Exceptions | |
---|---|
java.lang.IllegalStateException |
if saveAttributes() has been called since the underlying file was initially parsed, since that means offsets may have changed. |
hasAttribute
open fun hasAttribute(tag: String): Boolean
Returns true if the image file has the given attribute defined.
Parameters | |
---|---|
tag |
String: the name of the tag. This value cannot be null . |
hasThumbnail
open fun hasThumbnail(): Boolean
Returns true if the image file has a thumbnail.
isSupportedMimeType
open static fun isSupportedMimeType(mimeType: String): Boolean
Returns whether ExifInterface currently supports reading data from the specified mime type or not.
Parameters | |
---|---|
mimeType |
String: the string value of mime type This value cannot be null . |
isThumbnailCompressed
open fun isThumbnailCompressed(): Boolean
Returns true if thumbnail image is JPEG Compressed, or false if either thumbnail image does not exist or thumbnail image is uncompressed.
saveAttributes
open fun saveAttributes(): Unit
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(java.lang.String,java.lang.String)
to set all attributes to write and make a single call rather than multiple calls for each attribute.
This method is supported for JPEG, PNG, and WebP files.
Note: after calling this method, any attempts to obtain range information from getAttributeRange(java.lang.String)
or getThumbnailRange()
will throw IllegalStateException
, since the offsets may have changed in the newly written file.
For WebP format, the Exif data will be stored as an Extended File Format, and it may not be supported for older readers.
For PNG format, the Exif data will be stored as an "eXIf" chunk as per "Extensions to the PNG 1.2 Specification, Version 1.5.0".
Warning: Calling this method on a DNG-based instance of ExifInterface
may result in the original image file being overwritten with invalid data on some versions of Android 13 (API 33).
setAttribute
open fun setAttribute(
tag: String,
value: String?
): Unit
Set the value of the specified tag.
Parameters | |
---|---|
tag |
String: the name of the tag. This value cannot be null . |
value |
String?: the value of the tag. This value may be null . |