Press on the image to return to the main documentation page.
JpegUtils
Written by Andrew Graham
This library contains an ExifData object for reading and writing Exif tags in a JPEG file.
Note that this object cannot read a file in File.DirAssets.
List of types:
ExifData
ExifData
This is an object for reading and writing Exif tags in a JPEG file.
The base functionality of the object requires Android 2.0.
The following tags are only supported by Android 2.2 or later.
TAG_FOCAL_LENGTH, TAG_GPS_DATESTAMP, TAG_GPS_PROCESSING_METHOD and TAG_GPS_TIMESTAMP.
The following tags are only supported by Android 2.3 or later.
TAG_GPS_ALTITUDE and TAG_GPS_ALTITUDE_REF.
The following tags are only supported by Android 3.0 or later.
TAG_APERTURE, TAG_EXPOSURE_TIME and TAG_ISO.
Events:
None
Members:
DecodeThumbnail
(
imagedata
()
As
Byte
)
As
android
.
graphics
.
Bitmap
getAttribute
(
tag
As
String
)
As
String
getAttributeDouble
(
tag
As
String
,
defaultValue
As
Double
)
As
Double
getAttributeInt
(
tag
As
String
,
defaultValue
As
Int
)
As
Int
getLatLong
(
output
()
As
Float
)
As
Boolean
hasThumbnail
As
Boolean
Initialize
(
dir
As
String
,
filename
As
String
)
ORIENTATION_FLIP_HORIZONTAL
As
Int
ORIENTATION_FLIP_VERTICAL
As
Int
ORIENTATION_NORMAL
As
Int
ORIENTATION_ROTATE_180
As
Int
ORIENTATION_ROTATE_270
As
Int
ORIENTATION_ROTATE_90
As
Int
ORIENTATION_TRANSPOSE
As
Int
ORIENTATION_TRANSVERSE
As
Int
ORIENTATION_UNDEFINED
As
Int
saveAttributes
setAttribute
(
tag
As
String
,
value
As
String
)
TAG_APERTURE
As
String
TAG_DATETIME
As
String
TAG_EXPOSURE_TIME
As
String
TAG_FLASH
As
String
TAG_FOCAL_LENGTH
As
String
TAG_GPS_ALTITUDE
As
String
TAG_GPS_ALTITUDE_REF
As
String
TAG_GPS_DATESTAMP
As
String
TAG_GPS_LATITUDE
As
String
TAG_GPS_LATITUDE_REF
As
String
TAG_GPS_LONGITUDE
As
String
TAG_GPS_LONGITUDE_REF
As
String
TAG_GPS_PROCESSING_METHOD
As
String
TAG_GPS_TIMESTAMP
As
String
TAG_IMAGE_LENGTH
As
String
TAG_IMAGE_WIDTH
As
String
TAG_ISO
As
String
TAG_MAKE
As
String
TAG_MODEL
As
String
TAG_ORIENTATION
As
String
TAG_WHITE_BALANCE
As
String
Thumbnail
()
As
Byte
[read
only]
Version
As
Double
[read
only]
WHITEBALANCE_AUTO
As
Int
WHITEBALANCE_MANUAL
As
Int
Members description:
DecodeThumbnail
(
imagedata
()
As
Byte
)
As
android
.
graphics
.
Bitmap
Decode an immutable bitmap from the specified byte array.
Returns the decoded bitmap, or null if the image could not be decoded.
getAttribute
(
tag
As
String
)
As
String
Returns the value of the specified tag or "" if there is no such tag in the JPEG file.
getAttributeDouble
(
tag
As
String
,
defaultValue
As
Double
)
As
Double
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.
getAttributeInt
(
tag
As
String
,
defaultValue
As
Int
)
As
Int
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.
getLatLong
(
output
()
As
Float
)
As
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.
hasThumbnail
As
Boolean
Returns true if the JPEG file has a thumbnail.
Initialize
(
dir
As
String
,
filename
As
String
)
Initialize the ExifData object with a file name.
This will throw an esception if the Android version is earlier than 2.0.
ORIENTATION_FLIP_HORIZONTAL
As
Int
ORIENTATION_FLIP_VERTICAL
As
Int
ORIENTATION_NORMAL
As
Int
ORIENTATION_ROTATE_180
As
Int
ORIENTATION_ROTATE_270
As
Int
ORIENTATION_ROTATE_90
As
Int
ORIENTATION_TRANSPOSE
As
Int
ORIENTATION_TRANSVERSE
As
Int
ORIENTATION_UNDEFINED
As
Int
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.
setAttribute
(
tag
As
String
,
value
As
String
)
Set the value of the specified tag.
TAG_APERTURE
As
String
Attribute is string.
TAG_DATETIME
As
String
Attribute is string.
TAG_EXPOSURE_TIME
As
String
Attribute is string.
TAG_FLASH
As
String
Attribute is int.
TAG_FOCAL_LENGTH
As
String
Attribute is rational.
TAG_GPS_ALTITUDE
As
String
The altitude (in meters) based on the reference in TAG_GPS_ALTITUDE_REF.
Attribute is rational.
TAG_GPS_ALTITUDE_REF
As
String
0 if the altitude is above sea level. 1 if the altitude is below sea level.
Attribute is int.
TAG_GPS_DATESTAMP
As
String
Attribute is string.
TAG_GPS_LATITUDE
As
String
Format is "num1/denom1,num2/denom2,num3/denom3".
Attribute is string.
TAG_GPS_LATITUDE_REF
As
String
Attribute is string.
TAG_GPS_LONGITUDE
As
String
Format is "num1/denom1,num2/denom2,num3/denom3".
Attribute is string.
TAG_GPS_LONGITUDE_REF
As
String
TAG_GPS_PROCESSING_METHOD
As
String
Name of GPS processing method used for location finding.
Attribute is String.
TAG_GPS_TIMESTAMP
As
String
Attribute is string.
TAG_IMAGE_LENGTH
As
String
Attribute is int.
TAG_IMAGE_WIDTH
As
String
Attribute is int.
TAG_ISO
As
String
Attribute is string.
TAG_MAKE
As
String
Attribute is string.
TAG_MODEL
As
String
Attribute is string.
TAG_ORIENTATION
As
String
Attribute is string.
TAG_WHITE_BALANCE
As
String
Attribute is int.
Thumbnail
()
As
Byte
[read
only]
Returns the thumbnail inside the JPEG file, or an empty array if there is no thumbnail.
The returned data is in JPEG format and can be decoded using decodeByteArray(byte[], int, int)
Version
As
Double
[read
only]
Returns the version number of the library.
WHITEBALANCE_AUTO
As
Int
Attribute is string.
WHITEBALANCE_MANUAL
As
Int
Attribute is string.
Top