10 releases

0.3.1 Jun 17, 2018
0.3.0 Oct 22, 2017
0.2.3 Jul 16, 2017
0.2.1 Mar 27, 2017
0.1.0 Dec 31, 2016

#3 in Encoding

Download history 91/week @ 2019-04-23 44/week @ 2019-04-30 102/week @ 2019-05-07 72/week @ 2019-05-14 139/week @ 2019-05-21 89/week @ 2019-05-28 135/week @ 2019-06-04 91/week @ 2019-06-11 205/week @ 2019-06-18 224/week @ 2019-06-25 202/week @ 2019-07-02 160/week @ 2019-07-09 155/week @ 2019-07-16 164/week @ 2019-07-23 37/week @ 2019-07-30

344 downloads per month
Used in 6 crates

BSD-2-Clause

155KB
3K SLoC

Exif parsing library written in pure Rust

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

Usage

Add a dependency entry to your Cargo.toml. Specify "kamadak-exif" if you use crates.io. The canonical name of this crate is "exif", but it is renamed on crates.io to avoid a naming conflict.

  [dependencies]
  kamadak-exif = "0.3"

Add the following to your crate root.

  extern crate exif;

Run "cargo doc" in the source directory to generate the API reference. It is also available online at https://docs.rs/kamadak-exif.

See examples directory for sample codes.

Dependencies

Rust 1.20 or later is required to build.

Specifications

  • Exif Version 2.31
  • TIFF Revision 6.0

lib.rs:

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.

No runtime deps