Documentation
  • Coverage
  • 0%
    0 out of 19 items documented0 out of 6 items with examples
  • Size
  • Source code size: 10.84 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • alexipeck/exif
    2 2 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • alexipeck

Exif reader. Pull all exif tags and values from a file, requires exiftool to be installed. There are 3 modes of importing, All, Whitelist and Blacklist.

pub const TEST_FILE_PATH: &str = r"PATH_TO_FILE";
pub fn main() {
    if !exiftool_available() {
        //handle error
        panic!("Exiftool not available for execution.");
    }
    
    //pull all exif tags/values
    match Exif::new(Path::new(TEST_FILE_PATH), Mode::All) {
        Ok(exif) => {
            for (tag, value) in exif.attributes.iter() {
                println!("{}:{}", tag, value);
            }
        }
        Err(err) => {
            //handle error
            panic!("{}", err);
        }
    };
    
    //pull exif tags/values filtered by whitelist
    let whitelist = create_list_from_vec(vec![
        "GPSLatitude",
        "GPSLongitude",
        "GPSAltitude",
        "ExifImageWidth",
        "ExifImageHeight",
        "FlightYawDegree",
        "AbsoluteAltitude",
        "RelativeAltitude",
        "FieldOfView",
        "FocalLength",
    ]);
    match Exif::new(Path::new(TEST_FILE_PATH), Mode::Whitelist(whitelist)) {
        Ok(exif) => {
            for (tag, value) in exif.attributes.iter() {
                println!("{}:{}", tag, value);
            }
        }
        Err(err) => {
            //handle error
            panic!("{}", err);
        }
    };
    
    //pull exif tags/values filtered by blacklist
    let blacklist = create_list_from_vec(vec![
        "SerialNumber",
        "FileModificationDate/Time",
        "DigitalZoomRatio",
        "XPComment",
        "XPKeywords",
    ]);
    match Exif::new(Path::new(TEST_FILE_PATH), Mode::Blacklist(blacklist)) {
        Ok(exif) => {
            for (tag, value) in exif.attributes.iter() {
                println!("{}:{}", tag, value);
            }
        }
        Err(err) => {
            //handle error
            panic!("{}", err);
        }
    };
}