Expand description
QRCode encoder
This crate provides a QR code and Micro QR code encoder for binary data.
use qrcode::QrCode;
use image::Luma;
// 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();
// You can also render it into a string.
let string = code.render()
.light_color(' ')
.dark_color('#')
.build();
println!("{}", string);
Modules
- The
bits
module encodes binary data into raw bits used in a QR code. - The
canvas
module puts raw bits into the QR code canvas. - The
ec
module applies the Reed-Solomon error correction codes. - Find the optimal data mode sequence to encode a piece of data.
- Render a QR code into image.
Structs
- The encoded QR code symbol.
Enums
- The color of a module.
- The error correction level. It allows the original information be recovered even if parts of the code is damaged.
- In QR code terminology,
Version
means the size of the generated image. Larger version means the size of code is larger, and therefore can carry more information.
Type Definitions
QrResult
is a convenient alias for a QR code generation result.