[][src]Crate rexif

RExif is a native Rust create, written to extract EXIF data from JPEG and TIFF images.

Note that it is in very early stages of development. Any sort of feedback is welcome!

The crate contains a sample binary called 'rexiftool' that accepts files as arguments and prints the EXIF data. It gives a rough idea on how to use the crate. Get some sample images and run

cargo run [image file 1] [image file 2] ...

To learn to use this crate, start by the documentation of function parse_file(), and the struct ExifData that is returned by the parser. The rest falls more or less into place.

Code sample lightly edited from src/bin.rs:

use std::error::Error;

let file_name = "foo.jpg";
match rexif::parse_file(&file_name) {
    Ok(exif) => {
        println!("{} {} exif entries: {}", file_name, exif.mime, exif.entries.len());
        for entry in &exif.entries {
            println!("\t{}: {}", entry.tag, entry.value_more_readable);
        }
    },
    Err(e) => {
        print!("Error in {}: {}", &file_name, e)
    }
}

Structs

ExifData

Top-level structure that contains all parsed metadata inside an image

ExifEntry

Structure that represents a parsed EXIF tag.

IRational

Encapsulation of the TIFF type that represents a signed rational number

IfdEntry

Structure that represents a parsed IFD entry of a TIFF image

URational

Encapsulation of the TIFF type that represents an unsigned rational number

Enums

ExifError

Possible fatal errors that may happen when an image is parsed.

ExifTag

Enumeration that represents recognized EXIF tags found in TIFF IFDs.

IfdFormat

Enumeration that represents the possible data formats of an IFD entry.

IfdKind
Namespace

Enumeration that represent EXIF tag namespaces. Namespaces exist to accomodate future parsing of the manufacturer-specific tags embedded within the MarkerNote tag.

TagValue

Tag value enumeration. It works as a variant type. Each value is actually a vector because many EXIF tags are collections of values. Exif tags with single values are represented as single-item vectors.

Constants

EXIF_HEADER

The value of the Exif header.

Functions

ifdformat_new

Convert an IFD format code to the IfdFormat enumeration

parse_buffer

Parse a byte buffer that should contain a TIFF or JPEG image. Tries to detect format and parse EXIF data.

parse_buffer_quiet

Parse a byte buffer that should contain a TIFF or JPEG image. Tries to detect format and parse EXIF data.

parse_file

Opens an image (passed as a file name), tries to read and parse it.

read_file

Try to read and parse an open file that is expected to contain an image

Type Definitions

ExifEntryResult

Type resturned by lower-level parsing functions

ExifResult

Type returned by image file parsing