File: encode_image.rs

package info (click to toggle)
rust-qrencode 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 424 kB
  • sloc: makefile: 2
file content (13 lines) | stat: -rw-r--r-- 297 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
use image::Luma;
use qrencode::QrCode;

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