A C++ header-only QR encode Library.
- header only
- easy to use
just #include "opqr/opqr.hpp"
.
QR qr1("https://github.com/caozhanhao/opqr"); // string
QR qr2(std::vector{ 0,1,2,3 });//or other containers, e.g. std::list, std::initializer_list
QR qr1;
qr1.add_data({ 4,5,6,7 });// initializer_list or some containers
QR qr2;
qr2.add_data(789); // integral value
QR qr(20, ECLevel::Q, Mode::ALNUM, 0);
QR qr("12345");
qr.set_version(10);
qr.set_level(ECLevel::L);
qr.set_mode(Mode::NUM);
qr.set_mask(6);
qr.disable_quiet_zone();
- JPG
- PNG
- TGA
- BMP
- ANSI
- the image size = dimension * enlarge x dimension * enlarge
- the image size = width x height
auto pic = qr.generate();
pic.paint(pic::Format::BMP, "example.bmp", 10);
std::ofstream fs("examples/example2.png", std::ios::binary | std::ios::out);
pic.paint(pic::Format::PNG, fs, 1024, 1024);
fs.close();
For more examples, see here
- There may be bugs in Kanji Mode
- stb (also header-only)
- C++ 17