Crates.io | jfifdump-cli |
lib.rs | jfifdump-cli |
version | 0.6.0 |
source | src |
created_at | 2022-07-07 14:46:26.324566 |
updated_at | 2024-10-05 11:34:10.050135 |
description | Read and dump structure of a jpeg file |
homepage | |
repository | https://github.com/vstroebel/jfifdump.git |
max_upload_size | |
id | 621215 |
size | 11,157 |
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-cli
$ jfifdump image.jpeg
Read and dump structure of a jpeg file
Usage: jfifdump [OPTIONS] <INPUT>
Arguments:
<INPUT> Jpeg file to use
Options:
-f, --format <FORMAT> Output format [default: text] [possible values: text, json]
-v, --verbose Make output more verbose
-h, --help Print help
-V, --version Print version
To use jfifdump as a library add the following to your Cargo.toml dependencies:
jfifdump = "0.6"
use jfifdump::{Reader, SegmentKind, 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()?.kind {
SegmentKind::Eoi => break,
SegmentKind::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.