#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

#5 in Encoding

Download history 43/week @ 2019-01-19 52/week @ 2019-01-26 172/week @ 2019-02-02 82/week @ 2019-02-09 46/week @ 2019-02-16 14/week @ 2019-02-23 71/week @ 2019-03-02 102/week @ 2019-03-09 31/week @ 2019-03-16 166/week @ 2019-03-23 17/week @ 2019-03-30 35/week @ 2019-04-06 57/week @ 2019-04-13 115/week @ 2019-04-20 37/week @ 2019-04-27

74 downloads per month
Used in 4 crates

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