Crate exif[][src]

This is a pure-Rust library to parse Exif data. This library can parse TIFF and JPEG images and extract Exif attributes.

Examples

An example to parse JPEG/TIFF files:

for path in &["tests/exif.jpg", "tests/exif.tif"] {
    let file = std::fs::File::open(path).unwrap();
    let reader = exif::Reader::new(
        &mut std::io::BufReader::new(&file)).unwrap();
    for f in reader.fields() {
        println!("{} {} {}",
                 f.tag, f.thumbnail, f.value.display_as(f.tag));
    }
}

Compatibility

Major changes between 0.2.3 and 0.3 are listed below.

  • Enum Error has two new variants: TooBig and NotSupported.
  • Value::Undefined has the 2nd member to keep the offset of the value.
  • Struct DateTime has two new fields: nanosecond and offset.
  • The tag constants have been changed to associated constants of struct Tag. Use Tag::TagName instead of tag::TagName.

Modules

experimental

The interfaces in this module are experimental and unstable.

tag

A module that contains Exif tag constants.

Structs

DateTime

A struct used to parse a DateTime field.

Field

A TIFF field.

Rational

An unsigned rational number, which is a pair of 32-bit unsigned integers.

Reader

The Reader struct reads a JPEG or TIFF image, parses the Exif attributes in it, and holds the results.

SRational

A signed rational number, which is a pair of 32-bit signed integers.

Tag

A tag of a TIFF field.

Enums

Context

An enum that indicates how a tag number is interpreted.

Error

An error type returned when parsing Exif data.

Value

Types and values of TIFF fields (for Exif attributes).

Functions

get_exif_attr_from_jpeg

Get the Exif attribute information segment from a JPEG file.

parse_exif

Parse the Exif attributes in the TIFF format.