Skip to main content

Crate fastexif

Crate fastexif 

Source
Expand description

§fastexif

Crates.io Version Docs dependency status

Exif metadata reader with convenience wrappers for GPS/time tags.

§Examples

§Read GPS location

let data = ...;
let options = Default::default();
let tiff = fastexif::parse(&data)?.into_entry_map(options)?;
if let Some(gps) = tiff.get_gps_info() {
    let location = (gps.longitude(), gps.latitude(), gps.altitude());
    println!("GPS location: {location:?}");
}

§Convert Exif tags to JSON

let data = ...;
let options = Default::default();
let tiff = fastexif::parse(&data)?.into_entry_map(options)?;
println!("{}", serde_json::to_string_pretty(&tiff)?);

§Read Apple-specific tags (experimental)

use fastexif::exif::MakerNote;

let data = ...;
let options = Default::default();
let tiff = fastexif::parse(&data)?.into_entry_map(options)?;
if let Some(exif) = tiff.get_exif() {
    if let Some(MakerNote::Apple(apple)) = exif.get_maker_note() {
        // `Front` or `Back`.
        println!("Camera type: {:?}", apple.get_camera_type());
    }
}

§Tags reference

Below you can find high-level API for accessing tags. For each tag there is a get_* method that returns the associated value wrapped in a type. Tags are stored in several nested tables; the following nested list reflects the overall structure.

Full description of each tag is in Exif standard that you can download from cipa.jp.

Modules§

appleapple
Apple-specific maker notes.
exif
Exif tags.
gps
GPS tags.
interop
Interoperability tags.
tiff
TIFF tags.

Structs§

InvalidExif
Exif parsing error.
ParseOptions
Parser options.
SignedRational
Signed rational number.
UnsignedRational
Unsigned rational number.

Enums§

Value
A enumeration of all possible value types and Exif tag can have.

Functions§

parse
Parse Exif metadata from the provided byte slice.