Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exif support attempt number 2 #242

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/target/
**/*.rs.bk
Cargo.lock
.idea/
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ exclude = ["tests/images/*", "tests/fuzz_images/*"]
weezl = "0.1.0"
jpeg = { package = "jpeg-decoder", version = "0.3.0", default-features = false }
flate2 = "1.0.20"
image = "0.24.8"
itertools = "0.13.0"

[dev-dependencies]
clap = { version = "4.0.32", features = ["derive"] }
criterion = "0.3.1"
kamadak-exif = "0.5.5"

[[bench]]
name = "lzw"
Expand Down
54 changes: 54 additions & 0 deletions examples/print-exif.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
extern crate exif;
extern crate tiff;

use tiff::{
decoder::TiffDecoder,
ifd::{Directory, ImageFileDirectory, ProcessedEntry},
tags::{GpsTag, Tag},
};

use clap::Parser;
use std::fs::File;
use std::path::PathBuf;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Cli {
/// Path to the exposure folder containing the index.tse file
#[arg(required = true)]
path: PathBuf,
}

fn main() {
let args = Cli::parse();

let img_file = File::open(args.path).expect("Cannot find test image!");
let mut decoder = TiffDecoder::new(img_file).expect("Cannot create decoder");
let mut exif: Directory<ProcessedEntry> = decoder
.get_exif_data()
.expect("Unable to read Exif data")
.into_iter()
.collect();
print!("{exif}");

exif = decoder
.get_exif_ifd(Tag::ExifIfd)
.expect("Unable to read Exif data")
.into_iter()
.collect();
print!("{exif}");

let gps_exif = decoder
.get_gps_ifd()
.expect("Unable to read Exif data")
.into_iter()
.collect::<ImageFileDirectory<GpsTag, ProcessedEntry>>();
print!("{gps_exif}");

exif = decoder
.get_exif_ifd(Tag::InteropIfd)
.expect("Unable to read Exif data")
.into_iter()
.collect();
print!("{exif}");
}
Loading