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();
}