https://github.com/vstroebel/jfifdump
Dump structure of a jpeg file
https://github.com/vstroebel/jfifdump
command-line-tool jpeg
Last synced: 8 months ago
JSON representation
Dump structure of a jpeg file
- Host: GitHub
- URL: https://github.com/vstroebel/jfifdump
- Owner: vstroebel
- License: apache-2.0
- Created: 2021-05-04T17:35:29.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-05T11:32:43.000Z (over 1 year ago)
- Last Synced: 2025-01-09T13:44:47.637Z (over 1 year ago)
- Topics: command-line-tool, jpeg
- Language: Rust
- Homepage:
- Size: 97.7 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# JFIF-Dump
[](https://docs.rs/jfifdump/latest/jfifdump/)
[](https://crates.io/crates/jfifdump/)
[](https://github.com/vstroebel/jfifdump/actions/workflows/rust.yml)
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]
Arguments:
Jpeg file to use
Options:
-f, --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:
```toml
jfifdump = "0.6"
```
## Example: Print image dimensions
```rust
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
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
## 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.