17 lines
337 B
Rust
17 lines
337 B
Rust
|
extern crate qrcode;
|
||
|
extern crate image;
|
||
|
|
||
|
use qrcode::QrCode;
|
||
|
use image::Luma;
|
||
|
|
||
|
fn main() {
|
||
|
// Encode some data into bits.
|
||
|
let code = QrCode::new(b"01234567").unwrap();
|
||
|
|
||
|
// Render the bits into an image.
|
||
|
let image = code.render::<Luma<u8>>().build();
|
||
|
|
||
|
// Save the image.
|
||
|
image.save("/tmp/qrcode.png").unwrap();
|
||
|
}
|