Crates.io | zbar-rust |
lib.rs | zbar-rust |
version | 0.0.24 |
source | src |
created_at | 2018-10-31 08:35:48.502609 |
updated_at | 2024-08-11 11:56:57.983466 |
description | High-level and low-level ZBar binding for the Rust language. |
homepage | https://magiclen.org/zbar-rust |
repository | https://github.com/magiclen/zbar-rust |
max_upload_size | |
id | 93770 |
size | 76,716 |
High-level and low-level ZBar binding for the Rust language.
To compile this crate, you need to compile the ZBar library first. You can install ZBar in your operating system, or in somewhere in your file system. As for the latter, you need to set the following environment variables to link the ZBar library:
ZBAR_LIB_DIRS
: The directories of library files, like -L
. Use :
to separate.ZBAR_LIBS
: The library names that you want to link, like -l
. Use :
to separate. Typically, it is iconv:zbar.ZBAR_INCLUDE_DIRS
: The directories of header files, like -i
. Use :
to separate.use zbar_rust::ZBarImageScanner;
use image::GenericImageView;
let img = image::open(INPUT_IMAGE_PATH).unwrap();
let (width, height) = img.dimensions();
let mut scanner = ZBarImageScanner::new();
let mut results = scanner.scan_y800(img.into_luma8().into_raw(), width, height).unwrap();
for result in results {
println!("{}", String::from_utf8(result.data).unwrap())
}
More examples are in the examples
folder.
https://crates.io/crates/zbar-rust