#jpeg #image

jfifdump

Read and dump structure of a jpeg file

9 unstable releases (4 breaking)

0.5.1 Jan 30, 2024
0.5.0 Oct 9, 2023
0.4.0 Sep 29, 2023
0.3.2 Feb 7, 2023
0.1.1 May 4, 2021

#246 in Images

Download history 810/week @ 2023-12-18 329/week @ 2023-12-25 545/week @ 2024-01-01 769/week @ 2024-01-08 750/week @ 2024-01-15 1319/week @ 2024-01-22 8749/week @ 2024-01-29 13641/week @ 2024-02-05 8285/week @ 2024-02-12 8261/week @ 2024-02-19 10316/week @ 2024-02-26 10638/week @ 2024-03-04 1856/week @ 2024-03-11 1236/week @ 2024-03-18 1472/week @ 2024-03-25 1429/week @ 2024-04-01

6,137 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

38KB
929 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.5"

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