#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

#8 in Encoding

Download history 123/week @ 2018-11-12 30/week @ 2018-11-19 104/week @ 2018-11-26 56/week @ 2018-12-03 85/week @ 2018-12-10 53/week @ 2018-12-17 83/week @ 2018-12-24 51/week @ 2018-12-31 57/week @ 2019-01-07 68/week @ 2019-01-14 38/week @ 2019-01-21 61/week @ 2019-01-28 190/week @ 2019-02-04 57/week @ 2019-02-11 46/week @ 2019-02-18

74 downloads per month
Used in 3 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