10 releases (5 breaking)

0.6.0 Oct 5, 2024
0.5.1 Jan 30, 2024
0.5.0 Oct 9, 2023
0.3.2 Feb 7, 2023
0.2.0 Jun 8, 2021

#74 in Images

Download history 41136/week @ 2024-07-29 23852/week @ 2024-08-05 47829/week @ 2024-08-12 46430/week @ 2024-08-19 18022/week @ 2024-08-26 23712/week @ 2024-09-02 23715/week @ 2024-09-09 29828/week @ 2024-09-16 28946/week @ 2024-09-23 29678/week @ 2024-09-30 30721/week @ 2024-10-07 22836/week @ 2024-10-14 29518/week @ 2024-10-21 34657/week @ 2024-10-28 38600/week @ 2024-11-04 28707/week @ 2024-11-11

132,400 downloads per month
Used in 4 crates (2 directly)

MIT/Apache

40KB
965 lines

JFIF-Dump

docs.rs badge crates.io badge Rust

Read and dump structure of a jpeg file.

This crate can be used as a library or as a command line utility.

Installation

$ cargo install jfifdump-cli

Usage

$ jfifdump image.jpeg

Command-line options

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

Using jfifdump as a library

To use jfifdump as a library add the following to your Cargo.toml dependencies:

jfifdump = "0.6"

Example: Print image dimensions

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(())
}

License

This project is licensed under either of

Contribution

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.

Dependencies

~37KB