Class Overview
This is a class for reading and writing Exif tags in a JPEG file.
Summary
Public Constructors |
|
ExifInterface(String filename)
Reads Exif tags from the specified JPEG file.
|
Public Methods |
double
|
getAltitude(double defaultValue)
Return the altitude in meters.
|
String
|
getAttribute(String tag)
Returns the value of the specified tag or null if there
is no such tag in the JPEG file.
|
double
|
getAttributeDouble(String tag, double defaultValue)
Returns the double value of the specified rational tag.
|
int
|
getAttributeInt(String tag, int defaultValue)
Returns the integer value of the specified tag.
|
boolean
|
getLatLong(float[] output)
Stores the latitude and longitude value in a float array.
|
byte[]
|
getThumbnail()
Returns the thumbnail inside the JPEG file, or null if there is no thumbnail.
|
boolean
|
hasThumbnail()
Returns true if the JPEG file has a thumbnail.
|
void
|
saveAttributes()
Save the tag data into the JPEG file.
|
void
|
setAttribute(String tag, String value)
Set the value of the specified tag.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
Constants
public
static
final
int
ORIENTATION_FLIP_HORIZONTAL
Constant Value:
2
(0x00000002)
public
static
final
int
ORIENTATION_FLIP_VERTICAL
Constant Value:
4
(0x00000004)
public
static
final
int
ORIENTATION_NORMAL
Constant Value:
1
(0x00000001)
public
static
final
int
ORIENTATION_ROTATE_180
Constant Value:
3
(0x00000003)
public
static
final
int
ORIENTATION_ROTATE_270
Constant Value:
8
(0x00000008)
public
static
final
int
ORIENTATION_ROTATE_90
Constant Value:
6
(0x00000006)
public
static
final
int
ORIENTATION_TRANSPOSE
Constant Value:
5
(0x00000005)
public
static
final
int
ORIENTATION_TRANSVERSE
Constant Value:
7
(0x00000007)
public
static
final
int
ORIENTATION_UNDEFINED
Constant Value:
0
(0x00000000)
public
static
final
String
TAG_APERTURE
Constant Value:
"FNumber"
public
static
final
String
TAG_DATETIME
Constant Value:
"DateTime"
public
static
final
String
TAG_EXPOSURE_TIME
Constant Value:
"ExposureTime"
public
static
final
String
TAG_FLASH
public
static
final
String
TAG_FOCAL_LENGTH
Constant Value:
"FocalLength"
public
static
final
String
TAG_GPS_ALTITUDE
The altitude (in meters) based on the reference in TAG_GPS_ALTITUDE_REF.
Type is rational.
Constant Value:
"GPSAltitude"
public
static
final
String
TAG_GPS_ALTITUDE_REF
0 if the altitude is above sea level. 1 if the altitude is below sea
level. Type is int.
Constant Value:
"GPSAltitudeRef"
public
static
final
String
TAG_GPS_DATESTAMP
Constant Value:
"GPSDateStamp"
public
static
final
String
TAG_GPS_LATITUDE
String. Format is "num1/denom1,num2/denom2,num3/denom3".
Constant Value:
"GPSLatitude"
public
static
final
String
TAG_GPS_LATITUDE_REF
Constant Value:
"GPSLatitudeRef"
public
static
final
String
TAG_GPS_LONGITUDE
String. Format is "num1/denom1,num2/denom2,num3/denom3".
Constant Value:
"GPSLongitude"
public
static
final
String
TAG_GPS_LONGITUDE_REF
Constant Value:
"GPSLongitudeRef"
public
static
final
String
TAG_GPS_PROCESSING_METHOD
Type is String. Name of GPS processing method used for location finding.
Constant Value:
"GPSProcessingMethod"
public
static
final
String
TAG_GPS_TIMESTAMP
Constant Value:
"GPSTimeStamp"
public
static
final
String
TAG_IMAGE_LENGTH
Constant Value:
"ImageLength"
public
static
final
String
TAG_IMAGE_WIDTH
Constant Value:
"ImageWidth"
public
static
final
String
TAG_ISO
Constant Value:
"ISOSpeedRatings"
public
static
final
String
TAG_MAKE
public
static
final
String
TAG_MODEL
public
static
final
String
TAG_ORIENTATION
Constant Value:
"Orientation"
public
static
final
String
TAG_WHITE_BALANCE
Constant Value:
"WhiteBalance"
public
static
final
int
WHITEBALANCE_AUTO
Constant Value:
0
(0x00000000)
public
static
final
int
WHITEBALANCE_MANUAL
Constant Value:
1
(0x00000001)
Public Constructors
public
ExifInterface
(String filename)
Reads Exif tags from the specified JPEG file.
Public Methods
public
double
getAltitude
(double defaultValue)
Return the altitude in meters. If the exif tag does not exist, return
defaultValue.
Parameters
defaultValue
| the value to return if the tag is not available.
|
public
String
getAttribute
(String tag)
Returns the value of the specified tag or null
if there
is no such tag in the JPEG file.
public
double
getAttributeDouble
(String tag, double defaultValue)
Returns the double value of the specified rational tag. If there is no
such tag in the JPEG file or the value cannot be parsed as double, return
defaultValue.
Parameters
tag
| the name of the tag. |
defaultValue
| the value to return if the tag is not available.
|
public
int
getAttributeInt
(String tag, int defaultValue)
Returns the integer value of the specified tag. If there is no such tag
in the JPEG file or the value cannot be parsed as integer, return
defaultValue.
Parameters
tag
| the name of the tag. |
defaultValue
| the value to return if the tag is not available.
|
public
boolean
getLatLong
(float[] output)
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.
public
byte[]
getThumbnail
()
Returns the thumbnail inside the JPEG file, or null
if there is no thumbnail.
The returned data is in JPEG format and can be decoded using
decodeByteArray(byte[], int, int)
public
boolean
hasThumbnail
()
Returns true if the JPEG file has a thumbnail.
public
void
saveAttributes
()
Save the tag data into the JPEG file. This is expensive because it involves
copying all the JPG data from one file to another and deleting the old file
and renaming the other. It's best to use setAttribute(String, String)
to set all attributes to write and make a single call rather than multiple
calls for each attribute.
public
void
setAttribute
(String tag, String value)
Set the value of the specified tag.
Parameters
tag
| the name of the tag. |
value
| the value of the tag.
|