Crates.io | qrcode-png |
lib.rs | qrcode-png |
version | 0.4.1 |
source | src |
created_at | 2020-05-25 10:52:19.067674 |
updated_at | 2022-09-07 06:48:32.558599 |
description | Generate QR code in png format |
homepage | https://github.com/wyhaya/qrcode-png |
repository | https://github.com/wyhaya/qrcode-png.git |
max_upload_size | |
id | 245527 |
size | 11,963 |
Generate QR code in png format
Add this in your Cargo.toml
:
[dependencies]
qrcode-png = "*"
use qrcode_png::*;
fn main() {
let mut qrcode = QrCode::new(b"Hello Rust !", QrCodeEcc::Medium).unwrap();
qrcode.margin(10);
qrcode.zoom(10);
let buf = qrcode.generate(Color::Grayscale(0, 255)).unwrap();
std::fs::write("./qrcode.png", buf).unwrap();
}