| An API for accessing EXIF encoded information in a JPEG file.
JPEG images are stored in a tagged format reminiscent of TIFF files.
Each component of the image is identified with a tag number and a size.
This allows applications that read JPEG files to skip over information
that they don't understand.
Additional resources:
- Official standards, http://www.exif.org/specifications.html
- TsuruZoh Tachibanaya's excellent description,
http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
- Matthias Wandel's JHead, http://www.sentex.net/~mwandel/jhead
This class treats a byte array as a JPEG image and parses the tags
searching for EXIF data. EXIF data is also tagged. Based on information
provided by the caller, this class builds a hash of EXIF data and
makes it available to the caller.
Most simple EXIF values are tagged with both their identity and their
format. For example, ExposureTime (0x829A) is a rational number and
this class can extract that value. However, some fields are of "unknown"
format. If you decode one of these, you can add a special purpose decode
for that field by associating the name of the decoder class with the
field name. For example, my Nikon CoolPix 950 includes a MakerNote (0x927C)
field that's tagged "unknown" format. Using information from TsuruZoh's
page, I've built a decoder for that field and added it as an example.
In addition to the tagged data, JPEG images have five intrinisic
properties: height, width, the compression algorithm used, the number of
bits used to store each pixel value, and the number of color components.
This class allows the caller to unify those intrinsic components with the
tagged data.
In an effort to be flexible without requiring users to change the
source, a fair bit of setup is needed to use this class.
The caller must:
- Construct an Exif object,
exif = new Exif() .
- Associate names with each of the tags of interest,
exif.addTag(nnn, "name") .
- Associate names with the intrinsic values:
exif.addHeight("name")
exif.addWidth("name")
exif.addCompression("name")
exif.addNumberOfColorComponents("name")
exif.addBitsPerPixel("name")
- Finally, the caller may associate a decoder with specific fields:
exif.addDecoder("name", "java.class.name") .
Having setup the exif object, it can be passed to JpegHeaders to be
filled in when the JPEG file is parsed.
The caller must also explicitly set the intrinsic values since they do
not come from the EXIF data.
After parsing the JPEG, call exif.getTags() to get back the
has of name/value pairs.
version: $Revision: 1.1 $ author: Norman Walsh See Also: ExifData See Also: TagDecoder See Also: JpegHeaders |