Read and dump structure of a jpeg file.
This crate can be used as a library or as a command line utility.
$ cargo install jfifdump
$ jfifdump image.jpeg
``` USAGE: jfifdump [FLAGS] [OPTIONS]
FLAGS: -v, --verbose Make output more verbose -h, --help Prints help information -V, --version Prints version information
OPTIONS:
-f, --format
ARGS: Jpeg file to use
```
To use jfifdump as a library add the following to your Cargo.toml dependencies:
toml
jfifdump = "0.2"
```rust use jfifdump::{Reader, Segment, JfifError}; use std::fs::File; use std::io::BufReader;
fn main() -> Result<(), JfifError> { let file = File::open("some.jpeg")?;
let mut reader = Reader::new(BufReader::new(file))?;
loop {
match reader.next_segment()? {
Segment::Eoi => break,
Segment::Frame(frame) => {
println!("{}x{}", frame.dimension_x, frame.dimension_y);
break;
}
_ => {
// Ignore other segments
}
}
}
Ok(())
} ```
This project is licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in jfifdump by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.