public class ExifInterface extends Object
Each ExifTag has a tag ID (TID) and is stored in a specific image file directory (IFD) as specified by the exif standard. A tag definition can be looked up with a constant that is a combination of TID and IFD. This definition has information about the type, number of components, and valid IFDs for a tag.
ExifTag
Modifier and Type | Class and Description |
---|---|
static interface |
ExifInterface.ColorSpace
Constants for
TAG_COLOR_SPACE |
static interface |
ExifInterface.ComponentsConfiguration
Constants for
TAG_COMPONENTS_CONFIGURATION |
static interface |
ExifInterface.Compression
Constants for
TAG_COMPRESSION |
static interface |
ExifInterface.Contrast
Constants for
TAG_CONTRAST |
static interface |
ExifInterface.ExposureMode
Constants for
TAG_EXPOSURE_MODE |
static interface |
ExifInterface.ExposureProgram
Constants for
TAG_EXPOSURE_PROGRAM |
static interface |
ExifInterface.FileSource
Constants for
TAG_FILE_SOURCE |
static interface |
ExifInterface.Flash
Constants for
TAG_FLASH As the definition in Jeita EXIF 2.2
standard, we can treat this constant as bitwise flag. |
static interface |
ExifInterface.GainControl
Constants for
TAG_GAIN_CONTROL |
static interface |
ExifInterface.GpsAltitudeRef
Constants for
TAG_GPS_ALTITUDE_REF |
static interface |
ExifInterface.GpsDifferential
Constants for
TAG_GPS_DIFFERENTIAL |
static interface |
ExifInterface.GpsLatitudeRef
Constants for
TAG_GPS_LATITUDE_REF ,
TAG_GPS_DEST_LATITUDE_REF |
static interface |
ExifInterface.GpsLongitudeRef
Constants for
TAG_GPS_LONGITUDE_REF ,
TAG_GPS_DEST_LONGITUDE_REF |
static interface |
ExifInterface.GpsMeasureMode
Constants for
TAG_GPS_MEASURE_MODE |
static interface |
ExifInterface.GpsSpeedRef
Constants for
TAG_GPS_SPEED_REF ,
TAG_GPS_DEST_DISTANCE_REF |
static interface |
ExifInterface.GpsStatus
Constants for
TAG_GPS_STATUS |
static interface |
ExifInterface.GpsTrackRef
Constants for
TAG_GPS_TRACK_REF ,
TAG_GPS_IMG_DIRECTION_REF , TAG_GPS_DEST_BEARING_REF |
static interface |
ExifInterface.LightSource
Constants for
TAG_LIGHT_SOURCE |
static interface |
ExifInterface.MeteringMode
Constants for
TAG_METERING_MODE |
static interface |
ExifInterface.Orientation
Constants for
TAG_ORIENTATION . |
static interface |
ExifInterface.PhotometricInterpretation
Constants for
TAG_PHOTOMETRIC_INTERPRETATION |
static interface |
ExifInterface.PlanarConfiguration
Constants for
TAG_PLANAR_CONFIGURATION |
static interface |
ExifInterface.ResolutionUnit
Constants for
TAG_RESOLUTION_UNIT |
static interface |
ExifInterface.Saturation
Constants for
TAG_SATURATION |
static interface |
ExifInterface.SceneCapture
Constants for
TAG_SCENE_CAPTURE_TYPE |
static interface |
ExifInterface.SceneType
Constants for
TAG_SCENE_TYPE |
static interface |
ExifInterface.SensingMethod
Constants for
TAG_SENSING_METHOD |
static interface |
ExifInterface.Sharpness
Constants for
TAG_SHARPNESS |
static interface |
ExifInterface.SubjectDistance
Constants for
TAG_SUBJECT_DISTANCE |
static interface |
ExifInterface.WhiteBalance
Constants for
TAG_WHITE_BALANCE |
static interface |
ExifInterface.YCbCrPositioning
Constants for
TAG_Y_CB_CR_POSITIONING |
Constructor and Description |
---|
ExifInterface() |
Modifier and Type | Method and Description |
---|---|
boolean |
addDateTimeStampTag(int tagId,
long timestamp,
TimeZone timezone)
Creates, formats, and sets the DateTimeStamp tag for one of:
TAG_DATE_TIME , TAG_DATE_TIME_DIGITIZED ,
TAG_DATE_TIME_ORIGINAL . |
boolean |
addGpsDateTimeStampTag(long timestamp)
Creates and sets the GPS timestamp tag.
|
boolean |
addGpsTags(double latitude,
double longitude)
Creates and sets all to the GPS tags for a give latitude and longitude.
|
ExifTag |
buildTag(int tagId,
int ifdId,
Object val)
Creates a tag for a defined tag constant in a given IFD if that IFD is
allowed for the tag.
|
ExifTag |
buildTag(int tagId,
Object val)
Creates a tag for a defined tag constant in the tag's default IFD.
|
protected ExifTag |
buildUninitializedTag(int tagId) |
void |
clearExif()
Clears this ExifInterface object's existing exif tags.
|
protected static void |
closeSilently(Closeable c) |
static double |
convertLatOrLongToDouble(Rational[] coordinate,
String reference)
Gets the double representation of the GPS latitude or longitude
coordinate.
|
static int |
defineTag(int ifdId,
short tagId)
Returns the constant representing a tag with a given TID and default IFD.
|
void |
deleteTag(int tagId)
Removes the ExifTag for a tag constant from that tag's default IFD.
|
void |
deleteTag(int tagId,
int ifdId)
Removes the ExifTag for a tag constant from the given IFD.
|
void |
forceRewriteExif(String filename)
Attempts to do an in-place rewrite of the exif metadata using the tags in
this ExifInterface object.
|
void |
forceRewriteExif(String filename,
Collection<ExifTag> tags)
Attempts to do an in-place rewrite of the exif metadata.
|
int |
getActualTagCount(int tagId,
int ifdId)
Gets the number of elements for an ExifTag in a given IFD.
|
protected static int |
getAllowedIfdFlagsFromInfo(int info) |
protected static int[] |
getAllowedIfdsFromInfo(int info) |
List<ExifTag> |
getAllTags()
Get the exif tags in this ExifInterface object or null if none exist.
|
protected static int |
getComponentCountFromInfo(int info) |
int |
getDefinedTagCount(int tagId)
Gets the defined number of elements for a tag.
|
int |
getDefinedTagDefaultIfd(int tagId)
Gets the default IFD for a tag.
|
short |
getDefinedTagType(int tagId)
Gets the defined type for a tag.
|
OutputStream |
getExifWriterStream(OutputStream outStream)
Wraps an OutputStream object with an ExifOutputStream.
|
OutputStream |
getExifWriterStream(String exifOutFileName)
Returns an OutputStream object that writes to a file.
|
protected static int |
getFlagsFromAllowedIfds(int[] allowedIfds) |
double[] |
getLatLongAsDoubles()
Gets the GPS latitude and longitude as a pair of doubles from this
ExifInterface object's tags, or null if the necessary tags do not exist.
|
static short |
getOrientationValueForRotation(int degrees)
Returns the Orientation ExifTag value for a given number of degrees.
|
static int |
getRotationForOrientationValue(short orientation)
Returns the rotation degrees corresponding to an ExifTag Orientation
value.
|
ExifTag |
getTag(int tagId)
Returns the ExifTag in that tag's default IFD for a defined tag constant
or null if none exists.
|
ExifTag |
getTag(int tagId,
int ifdId)
Gets an ExifTag for an IFD other than the tag's default.
|
Byte |
getTagByteValue(int tagId) |
Byte |
getTagByteValue(int tagId,
int ifdId) |
byte[] |
getTagByteValues(int tagId) |
byte[] |
getTagByteValues(int tagId,
int ifdId) |
protected int |
getTagDefinition(short tagId,
int defaultIfd) |
protected int |
getTagDefinitionForTag(ExifTag tag) |
protected int |
getTagDefinitionForTag(short tagId,
short type,
int count,
int ifd) |
protected int[] |
getTagDefinitionsForTagId(short tagId) |
protected SparseIntArray |
getTagInfo() |
Integer |
getTagIntValue(int tagId) |
Integer |
getTagIntValue(int tagId,
int ifdId) |
int[] |
getTagIntValues(int tagId) |
int[] |
getTagIntValues(int tagId,
int ifdId) |
Long |
getTagLongValue(int tagId) |
Long |
getTagLongValue(int tagId,
int ifdId) |
long[] |
getTagLongValues(int tagId) |
long[] |
getTagLongValues(int tagId,
int ifdId) |
Rational |
getTagRationalValue(int tagId) |
Rational |
getTagRationalValue(int tagId,
int ifdId) |
Rational[] |
getTagRationalValues(int tagId) |
Rational[] |
getTagRationalValues(int tagId,
int ifdId) |
List<ExifTag> |
getTagsForIfdId(int ifdId)
Returns a list of ExifTags that share an IFD (which can be obtained by
calling
#getTrueIFD on a defined tag constant) or null if none
exist. |
List<ExifTag> |
getTagsForTagId(short tagId)
Returns a list of ExifTags that share a TID (which can be obtained by
calling
getTrueTagKey(int) on a defined tag constant) or null if none
exist. |
String |
getTagStringValue(int tagId) |
String |
getTagStringValue(int tagId,
int ifdId) |
Object |
getTagValue(int tagId)
Returns the value of the ExifTag in that tag's default IFD for a defined
tag constant or null if none exists or the value could not be cast into
the return type.
|
Object |
getTagValue(int tagId,
int ifdId)
Gets a tag value for an IFD other than the tag's default.
|
byte[] |
getThumbnail()
Returns the thumbnail if it is jpeg compressed, or null if none exists.
|
Bitmap |
getThumbnailBitmap()
Returns the thumbnail from IFD1 as a bitmap, or null if none exists.
|
byte[] |
getThumbnailBytes()
Returns the thumbnail from IFD1 as a byte array, or null if none exists.
|
static int |
getTrueIfd(int tag)
Returns the default IFD for a tag constant.
|
static short |
getTrueTagKey(int tag)
Returns the TID for a tag constant.
|
protected static short |
getTypeFromInfo(int info) |
String |
getUserComment()
Decodes the user comment tag into string as specified in the EXIF
standard.
|
boolean |
hasThumbnail()
Check if thumbnail exists.
|
protected static boolean |
isIfdAllowed(int info,
int ifd) |
protected static boolean |
isOffsetTag(short tag)
Returns true if tag TID is one of the following:
TAG_EXIF_IFD ,
TAG_GPS_IFD , TAG_JPEG_INTERCHANGE_FORMAT ,
TAG_STRIP_OFFSETS , TAG_INTEROPERABILITY_IFD
Note: defining tags with these TID's is disallowed. |
boolean |
isTagCountDefined(int tagId)
Checks whether a tag has a defined number of elements.
|
boolean |
isThumbnailCompressed()
Check if thumbnail is compressed.
|
void |
readExif(byte[] jpeg)
Reads the exif tags from a byte array, clearing this ExifInterface
object's existing exif tags.
|
void |
readExif(InputStream inStream)
Reads the exif tags from an InputStream, clearing this ExifInterface
object's existing exif tags.
|
void |
readExif(String inFileName)
Reads the exif tags from a file, clearing this ExifInterface object's
existing exif tags.
|
void |
removeCompressedThumbnail()
Clears the compressed thumbnail if it exists.
|
void |
removeTagDefinition(int tagId)
Removes a tag definition for given defined tag constant.
|
void |
resetTagDefinitions()
Resets tag definitions to the default ones.
|
boolean |
rewriteExif(ByteBuffer buf,
Collection<ExifTag> tags)
Attempts to do an in-place rewrite the exif metadata in a ByteBuffer for
the given tags.
|
boolean |
rewriteExif(String filename,
Collection<ExifTag> tags)
Attempts to do an in-place rewrite the exif metadata in a file for the
given tags.
|
boolean |
setCompressedThumbnail(Bitmap thumb)
Sets the thumbnail to be a jpeg compressed bitmap.
|
boolean |
setCompressedThumbnail(byte[] thumb)
Sets the thumbnail to be a jpeg compressed image.
|
void |
setExif(Collection<ExifTag> tags)
Sets the exif tags, clearing this ExifInterface object's existing exif
tags.
|
ExifTag |
setTag(ExifTag tag)
Puts an ExifTag into this ExifInterface object's tags, removing a
previous ExifTag with the same TID and IFD.
|
int |
setTagDefinition(short tagId,
int defaultIfd,
short tagType,
short defaultComponentCount,
int[] allowedIfds)
Creates a new tag definition in this ExifInterface object for a given TID
and default IFD.
|
void |
setTags(Collection<ExifTag> tags)
Puts a collection of ExifTags into this ExifInterface objects's tags.
|
boolean |
setTagValue(int tagId,
int ifdId,
Object val)
Sets the value of an ExifTag if it exists in the given IFD.
|
boolean |
setTagValue(int tagId,
Object val)
Sets the value of an ExifTag if it exists it's default IFD.
|
void |
writeExif(Bitmap bmap,
OutputStream exifOutStream)
Writes the tags from this ExifInterface object into a jpeg compressed
bitmap, removing prior exif tags.
|
void |
writeExif(Bitmap bmap,
String exifOutFileName)
Writes the tags from this ExifInterface object into a jpeg compressed
bitmap, removing prior exif tags.
|
void |
writeExif(byte[] jpeg,
OutputStream exifOutStream)
Writes the tags from this ExifInterface object into a jpeg image,
removing prior exif tags.
|
void |
writeExif(byte[] jpeg,
String exifOutFileName)
Writes the tags from this ExifInterface object into a jpeg image,
removing prior exif tags.
|
void |
writeExif(InputStream jpegStream,
OutputStream exifOutStream)
Writes the tags from this ExifInterface object into a jpeg stream,
removing prior exif tags.
|
void |
writeExif(InputStream jpegStream,
String exifOutFileName)
Writes the tags from this ExifInterface object into a jpeg stream,
removing prior exif tags.
|
void |
writeExif(String jpegFileName,
String exifOutFileName)
Writes the tags from this ExifInterface object into a jpeg file, removing
prior exif tags.
|
public static final int TAG_NULL
public static final int IFD_NULL
public static final int DEFINITION_NULL
public static final int TAG_IMAGE_WIDTH
public static final int TAG_IMAGE_LENGTH
public static final int TAG_BITS_PER_SAMPLE
public static final int TAG_COMPRESSION
public static final int TAG_PHOTOMETRIC_INTERPRETATION
public static final int TAG_IMAGE_DESCRIPTION
public static final int TAG_MAKE
public static final int TAG_MODEL
public static final int TAG_STRIP_OFFSETS
public static final int TAG_ORIENTATION
public static final int TAG_SAMPLES_PER_PIXEL
public static final int TAG_ROWS_PER_STRIP
public static final int TAG_STRIP_BYTE_COUNTS
public static final int TAG_X_RESOLUTION
public static final int TAG_Y_RESOLUTION
public static final int TAG_PLANAR_CONFIGURATION
public static final int TAG_RESOLUTION_UNIT
public static final int TAG_TRANSFER_FUNCTION
public static final int TAG_SOFTWARE
public static final int TAG_DATE_TIME
public static final int TAG_ARTIST
public static final int TAG_WHITE_POINT
public static final int TAG_PRIMARY_CHROMATICITIES
public static final int TAG_Y_CB_CR_COEFFICIENTS
public static final int TAG_Y_CB_CR_SUB_SAMPLING
public static final int TAG_Y_CB_CR_POSITIONING
public static final int TAG_REFERENCE_BLACK_WHITE
public static final int TAG_COPYRIGHT
public static final int TAG_EXIF_IFD
public static final int TAG_GPS_IFD
public static final int TAG_JPEG_INTERCHANGE_FORMAT
public static final int TAG_JPEG_INTERCHANGE_FORMAT_LENGTH
public static final int TAG_EXPOSURE_TIME
public static final int TAG_F_NUMBER
public static final int TAG_EXPOSURE_PROGRAM
public static final int TAG_SPECTRAL_SENSITIVITY
public static final int TAG_ISO_SPEED_RATINGS
public static final int TAG_OECF
public static final int TAG_EXIF_VERSION
public static final int TAG_DATE_TIME_ORIGINAL
public static final int TAG_DATE_TIME_DIGITIZED
public static final int TAG_COMPONENTS_CONFIGURATION
public static final int TAG_COMPRESSED_BITS_PER_PIXEL
public static final int TAG_SHUTTER_SPEED_VALUE
public static final int TAG_APERTURE_VALUE
public static final int TAG_BRIGHTNESS_VALUE
public static final int TAG_EXPOSURE_BIAS_VALUE
public static final int TAG_MAX_APERTURE_VALUE
public static final int TAG_SUBJECT_DISTANCE
public static final int TAG_METERING_MODE
public static final int TAG_LIGHT_SOURCE
public static final int TAG_FLASH
public static final int TAG_FOCAL_LENGTH
public static final int TAG_SUBJECT_AREA
public static final int TAG_MAKER_NOTE
public static final int TAG_USER_COMMENT
public static final int TAG_SUB_SEC_TIME
public static final int TAG_SUB_SEC_TIME_ORIGINAL
public static final int TAG_SUB_SEC_TIME_DIGITIZED
public static final int TAG_FLASHPIX_VERSION
public static final int TAG_COLOR_SPACE
public static final int TAG_PIXEL_X_DIMENSION
public static final int TAG_PIXEL_Y_DIMENSION
public static final int TAG_RELATED_SOUND_FILE
public static final int TAG_INTEROPERABILITY_IFD
public static final int TAG_FLASH_ENERGY
public static final int TAG_SPATIAL_FREQUENCY_RESPONSE
public static final int TAG_FOCAL_PLANE_X_RESOLUTION
public static final int TAG_FOCAL_PLANE_Y_RESOLUTION
public static final int TAG_FOCAL_PLANE_RESOLUTION_UNIT
public static final int TAG_SUBJECT_LOCATION
public static final int TAG_EXPOSURE_INDEX
public static final int TAG_SENSING_METHOD
public static final int TAG_FILE_SOURCE
public static final int TAG_SCENE_TYPE
public static final int TAG_CFA_PATTERN
public static final int TAG_CUSTOM_RENDERED
public static final int TAG_EXPOSURE_MODE
public static final int TAG_WHITE_BALANCE
public static final int TAG_DIGITAL_ZOOM_RATIO
public static final int TAG_FOCAL_LENGTH_IN_35_MM_FILE
public static final int TAG_SCENE_CAPTURE_TYPE
public static final int TAG_GAIN_CONTROL
public static final int TAG_CONTRAST
public static final int TAG_SATURATION
public static final int TAG_SHARPNESS
public static final int TAG_DEVICE_SETTING_DESCRIPTION
public static final int TAG_SUBJECT_DISTANCE_RANGE
public static final int TAG_IMAGE_UNIQUE_ID
public static final int TAG_GPS_VERSION_ID
public static final int TAG_GPS_LATITUDE_REF
public static final int TAG_GPS_LATITUDE
public static final int TAG_GPS_LONGITUDE_REF
public static final int TAG_GPS_LONGITUDE
public static final int TAG_GPS_ALTITUDE_REF
public static final int TAG_GPS_ALTITUDE
public static final int TAG_GPS_TIME_STAMP
public static final int TAG_GPS_SATTELLITES
public static final int TAG_GPS_STATUS
public static final int TAG_GPS_MEASURE_MODE
public static final int TAG_GPS_DOP
public static final int TAG_GPS_SPEED_REF
public static final int TAG_GPS_SPEED
public static final int TAG_GPS_TRACK_REF
public static final int TAG_GPS_TRACK
public static final int TAG_GPS_IMG_DIRECTION_REF
public static final int TAG_GPS_IMG_DIRECTION
public static final int TAG_GPS_MAP_DATUM
public static final int TAG_GPS_DEST_LATITUDE_REF
public static final int TAG_GPS_DEST_LATITUDE
public static final int TAG_GPS_DEST_LONGITUDE_REF
public static final int TAG_GPS_DEST_LONGITUDE
public static final int TAG_GPS_DEST_BEARING_REF
public static final int TAG_GPS_DEST_BEARING
public static final int TAG_GPS_DEST_DISTANCE_REF
public static final int TAG_GPS_DEST_DISTANCE
public static final int TAG_GPS_PROCESSING_METHOD
public static final int TAG_GPS_AREA_INFORMATION
public static final int TAG_GPS_DATE_STAMP
public static final int TAG_GPS_DIFFERENTIAL
public static final int TAG_INTEROPERABILITY_INDEX
protected static HashSet<Short> sBannedDefines
public static final ByteOrder DEFAULT_BYTE_ORDER
public static int defineTag(int ifdId, short tagId)
public static short getTrueTagKey(int tag)
public static int getTrueIfd(int tag)
public void readExif(byte[] jpeg) throws IOException
jpeg
- a byte array containing a jpeg compressed image.IOException
public void readExif(InputStream inStream) throws IOException
inStream
- an InputStream containing a jpeg compressed image.IOException
public void readExif(String inFileName) throws FileNotFoundException, IOException
inFileName
- a string representing the filepath to jpeg file.FileNotFoundException
IOException
public void setExif(Collection<ExifTag> tags)
tags
- a collection of exif tags to set.public void clearExif()
public void writeExif(byte[] jpeg, OutputStream exifOutStream) throws IOException
jpeg
- a byte array containing a jpeg compressed image.exifOutStream
- an OutputStream to which the jpeg image with added
exif tags will be written.IOException
public void writeExif(Bitmap bmap, OutputStream exifOutStream) throws IOException
bmap
- a bitmap to compress and write exif into.exifOutStream
- the OutputStream to which the jpeg image with added
exif tags will be written.IOException
public void writeExif(InputStream jpegStream, OutputStream exifOutStream) throws IOException
jpegStream
- an InputStream containing a jpeg compressed image.exifOutStream
- an OutputStream to which the jpeg image with added
exif tags will be written.IOException
public void writeExif(byte[] jpeg, String exifOutFileName) throws FileNotFoundException, IOException
jpeg
- a byte array containing a jpeg compressed image.exifOutFileName
- a String containing the filepath to which the jpeg
image with added exif tags will be written.FileNotFoundException
IOException
public void writeExif(Bitmap bmap, String exifOutFileName) throws FileNotFoundException, IOException
bmap
- a bitmap to compress and write exif into.exifOutFileName
- a String containing the filepath to which the jpeg
image with added exif tags will be written.FileNotFoundException
IOException
public void writeExif(InputStream jpegStream, String exifOutFileName) throws FileNotFoundException, IOException
jpegStream
- an InputStream containing a jpeg compressed image.exifOutFileName
- a String containing the filepath to which the jpeg
image with added exif tags will be written.FileNotFoundException
IOException
public void writeExif(String jpegFileName, String exifOutFileName) throws FileNotFoundException, IOException
jpegFileName
- a String containing the filepath for a jpeg file.exifOutFileName
- a String containing the filepath to which the jpeg
image with added exif tags will be written.FileNotFoundException
IOException
public OutputStream getExifWriterStream(OutputStream outStream)
outStream
- an OutputStream to wrap.public OutputStream getExifWriterStream(String exifOutFileName) throws FileNotFoundException
exifOutFileName
- an String containing a filepath for a jpeg file.FileNotFoundException
public boolean rewriteExif(String filename, Collection<ExifTag> tags) throws FileNotFoundException, IOException
filename
- a String containing a filepath for a jpeg file with exif
tags to rewrite.tags
- tags that will be written into the jpeg file over existing
tags if possible.FileNotFoundException
IOException
public boolean rewriteExif(ByteBuffer buf, Collection<ExifTag> tags) throws IOException
buf
- a ByteBuffer containing a jpeg file with existing exif tags to
rewrite.tags
- tags that will be written into the jpeg ByteBuffer over
existing tags if possible.IOException
public void forceRewriteExif(String filename, Collection<ExifTag> tags) throws FileNotFoundException, IOException
filename
- a String containing a filepath for a jpeg file.tags
- tags that will be written into the jpeg file over existing
tags if possible.FileNotFoundException
IOException
rewriteExif(java.lang.String, java.util.Collection<com.android.gallery3d.exif.ExifTag>)
public void forceRewriteExif(String filename) throws FileNotFoundException, IOException
filename
- a String containing a filepath for a jpeg file.FileNotFoundException
IOException
rewriteExif(java.lang.String, java.util.Collection<com.android.gallery3d.exif.ExifTag>)
public List<ExifTag> getAllTags()
ExifTag
s.public List<ExifTag> getTagsForTagId(short tagId)
getTrueTagKey(int)
on a defined tag constant) or null if none
exist.tagId
- a TID as defined in the exif standard (or with
defineTag(int, short)
).ExifTag
s.public List<ExifTag> getTagsForIfdId(int ifdId)
#getTrueIFD
on a defined tag constant) or null if none
exist.ifdId
- an IFD as defined in the exif standard (or with
defineTag(int, short)
).ExifTag
s.public ExifTag getTag(int tagId, int ifdId)
getTag(int, int)
public ExifTag getTag(int tagId)
tagId
- a defined tag constant, e.g. TAG_IMAGE_WIDTH
.ExifTag
or null if none exists.public Object getTagValue(int tagId, int ifdId)
getTagValue(int, int)
public Object getTagValue(int tagId)
tagId
- a defined tag constant, e.g. TAG_IMAGE_WIDTH
.public String getTagStringValue(int tagId, int ifdId)
getTagValue(int, int)
public String getTagStringValue(int tagId)
getTagValue(int, int)
public Long getTagLongValue(int tagId, int ifdId)
getTagValue(int, int)
public Long getTagLongValue(int tagId)
getTagValue(int, int)
public Integer getTagIntValue(int tagId, int ifdId)
getTagValue(int, int)
public Integer getTagIntValue(int tagId)
getTagValue(int, int)
public Byte getTagByteValue(int tagId, int ifdId)
getTagValue(int, int)
public Byte getTagByteValue(int tagId)
getTagValue(int, int)
public Rational getTagRationalValue(int tagId, int ifdId)
getTagValue(int, int)
public Rational getTagRationalValue(int tagId)
getTagValue(int, int)
public long[] getTagLongValues(int tagId, int ifdId)
getTagValue(int, int)
public long[] getTagLongValues(int tagId)
getTagValue(int, int)
public int[] getTagIntValues(int tagId, int ifdId)
getTagValue(int, int)
public int[] getTagIntValues(int tagId)
getTagValue(int, int)
public byte[] getTagByteValues(int tagId, int ifdId)
getTagValue(int, int)
public byte[] getTagByteValues(int tagId)
getTagValue(int, int)
public Rational[] getTagRationalValues(int tagId, int ifdId)
getTagValue(int, int)
public Rational[] getTagRationalValues(int tagId)
getTagValue(int, int)
public boolean isTagCountDefined(int tagId)
tagId
- a defined tag constant, e.g. TAG_IMAGE_WIDTH
.public int getDefinedTagCount(int tagId)
tagId
- a defined tag constant, e.g. TAG_IMAGE_WIDTH
.ExifTag.SIZE_UNDEFINED
if the
tag or the number of elements is not defined.public int getActualTagCount(int tagId, int ifdId)
tagId
- a defined tag constant, e.g. TAG_IMAGE_WIDTH
.ifdId
- the IFD containing the ExifTag to check.public int getDefinedTagDefaultIfd(int tagId)
tagId
- a defined tag constant, e.g. TAG_IMAGE_WIDTH
.IFD_NULL
if no
definition exists.public short getDefinedTagType(int tagId)
tagId
- a defined tag constant, e.g. TAG_IMAGE_WIDTH
.ExifTag.getDataType()
protected static boolean isOffsetTag(short tag)
TAG_EXIF_IFD
,
TAG_GPS_IFD
, TAG_JPEG_INTERCHANGE_FORMAT
,
TAG_STRIP_OFFSETS
, TAG_INTEROPERABILITY_IFD
Note: defining tags with these TID's is disallowed.
tag
- a tag's TID (can be obtained from a defined tag constant with
getTrueTagKey(int)
).public ExifTag buildTag(int tagId, int ifdId, Object val)
ExifTag.setValue(int[])
for this tag's datatype would fail.tagId
- a tag constant, e.g. TAG_IMAGE_WIDTH
.ifdId
- the IFD that the tag should be in.val
- the value of the tag to set.buildTag(int, int, java.lang.Object)
public ExifTag buildTag(int tagId, Object val)
tagId
- a tag constant, e.g. TAG_IMAGE_WIDTH
.val
- the tag's value.protected ExifTag buildUninitializedTag(int tagId)
public boolean setTagValue(int tagId, int ifdId, Object val)
tagId
- a tag constant, e.g. TAG_IMAGE_WIDTH
.ifdId
- the IFD that the ExifTag is in.val
- the value to set.setTagValue(int, int, java.lang.Object)
public boolean setTagValue(int tagId, Object val)
tagId
- a tag constant, e.g. TAG_IMAGE_WIDTH
.val
- the value to set.public ExifTag setTag(ExifTag tag)
buildTag(int, int, java.lang.Object)
.tag
- an ExifTag to put into this ExifInterface's tags.public void setTags(Collection<ExifTag> tags)
tags
- a Collection of ExifTags.setTag(com.android.gallery3d.exif.ExifTag)
public void deleteTag(int tagId, int ifdId)
tagId
- a tag constant, e.g. TAG_IMAGE_WIDTH
.ifdId
- the IFD of the ExifTag to remove.public void deleteTag(int tagId)
tagId
- a tag constant, e.g. TAG_IMAGE_WIDTH
.public int setTagDefinition(short tagId, int defaultIfd, short tagType, short defaultComponentCount, int[] allowedIfds)
tagId
- the TID for the tag.defaultIfd
- the default IFD for the tag.tagType
- the type of the tag (see ExifTag.getDataType()
).defaultComponentCount
- the number of elements of this tag's type in
the tags value.allowedIfds
- the IFD's this tag is allowed to be put in.TAG_IMAGE_WIDTH
) or
TAG_NULL
if the definition could not be made.protected int getTagDefinition(short tagId, int defaultIfd)
protected int[] getTagDefinitionsForTagId(short tagId)
protected int getTagDefinitionForTag(ExifTag tag)
protected int getTagDefinitionForTag(short tagId, short type, int count, int ifd)
public void removeTagDefinition(int tagId)
tagId
- a defined tag constant, e.g. TAG_IMAGE_WIDTH
.public void resetTagDefinitions()
public Bitmap getThumbnailBitmap()
public byte[] getThumbnailBytes()
public byte[] getThumbnail()
public boolean isThumbnailCompressed()
public boolean hasThumbnail()
public boolean setCompressedThumbnail(byte[] thumb)
thumb
- a byte array containing a jpeg compressed image.public boolean setCompressedThumbnail(Bitmap thumb)
thumb
- a bitmap to compress to a jpeg thumbnail.public void removeCompressedThumbnail()
public String getUserComment()
public static short getOrientationValueForRotation(int degrees)
degrees
- the amount an image is rotated in degrees.public static int getRotationForOrientationValue(short orientation)
orientation
- the ExifTag Orientation value.public static double convertLatOrLongToDouble(Rational[] coordinate, String reference)
coordinate
- an array of 3 Rationals representing the degrees,
minutes, and seconds of the GPS location as defined in the
exif specification.reference
- a GPS reference reperesented by a String containing "N",
"S", "E", or "W".public double[] getLatLongAsDoubles()
convertLatOrLongToDouble(com.android.gallery3d.exif.Rational[], java.lang.String)
public boolean addDateTimeStampTag(int tagId, long timestamp, TimeZone timezone)
TAG_DATE_TIME
, TAG_DATE_TIME_DIGITIZED
,
TAG_DATE_TIME_ORIGINAL
.tagId
- one of the DateTimeStamp tags.timestamp
- a timestamp to format.timezone
- a TimeZone object.public boolean addGpsTags(double latitude, double longitude)
latitude
- a GPS latitude coordinate.longitude
- a GPS longitude coordinate.public boolean addGpsDateTimeStampTag(long timestamp)
timestamp
- a GPS timestamp.protected static void closeSilently(Closeable c)
protected SparseIntArray getTagInfo()
protected static int getAllowedIfdFlagsFromInfo(int info)
protected static int[] getAllowedIfdsFromInfo(int info)
protected static boolean isIfdAllowed(int info, int ifd)
protected static int getFlagsFromAllowedIfds(int[] allowedIfds)
protected static short getTypeFromInfo(int info)
protected static int getComponentCountFromInfo(int info)