Skip to content

wyhaya/qrcode-png

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qrcode-png

Crates.io LICENSE

Generate QR code in png format

Install

Add this in your Cargo.toml:

[dependencies]
qrcode-png = "*"

Example

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

qrcode