#Exif #JPEG #parser #reader #TIFF

kamadak-exif

Exif parsing library written in pure Rust

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

#17 in Encoding

Download history 43/week @ 2018-07-21 32/week @ 2018-07-28 75/week @ 2018-08-04 64/week @ 2018-08-11 16/week @ 2018-08-18 16/week @ 2018-08-25 28/week @ 2018-09-01 10/week @ 2018-09-08 42/week @ 2018-09-15 10/week @ 2018-09-22 54/week @ 2018-09-29 25/week @ 2018-10-06

74 downloads per month
Used in 1 crate

BSD-2-Clause

154KB
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