Crates.io | imageinfo |
lib.rs | imageinfo |
version | 0.7.17 |
source | src |
created_at | 2022-01-28 07:05:40.670722 |
updated_at | 2024-07-15 03:41:12.742212 |
description | Rust library to get image size and format without loading/decoding. |
homepage | |
repository | https://github.com/xiaozhuai/imageinfo-rs |
max_upload_size | |
id | 522966 |
size | 49,909 |
Rust library to get image size and format without loading/decoding.
The imageinfo don't get image format by file ext name, but infer by file header bytes and character.
A rewrite of c++ version imageinfo
Some test image files are from image-size. Many thanks to @netroy.
See https://crates.io/crates/imageinfo
use imageinfo::{ImageInfo};
fn main() {
match ImageInfo::from_file_path("images/valid/bmp/sample.bmp") {
Ok(info) => {
println!(" - Ext : {}", info.ext);
println!(" - Full Ext : {}", info.full_ext);
println!(" - Size : {}", info.size);
println!(" - Mimetype : {}", info.mimetype);
println!(" - Entries :");
for size in info.entry_sizes.iter() {
println!(" - {}", size);
}
}
Err(err) => {
println!(" - Err : {}", err);
}
}
}
Pretty easy?
Don't be stingy with your star : )