nanoqr
Extremely minimal QR code generator (V9 only)
Summary
| Latest Version | Unknown |
|---|---|
| License | Unknown |
| CI Status | Failing |
| Stars | 8 |
| Forks | 0 |
| Open Issues | 0 |
| Last Commit | 2025-10-18 |
| Downloads | 0 |
| Last Indexed | 2026-07-22 05:31 |
Tags
Installation
nimble install nanoqr
choosenim install nanoqr
git clone https://gitlab.com/bztsrc/nanoqr
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| nanoqr | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://gitlab.com/bztsrc/nanoqr |
|---|---|
| Homepage | https://gitlab.com/bztsrc/nanoqr |
| Registry Source | gitlab |
README
NanoQR
NanoQR is an stb-style, single header, single function ANSI C library to generate QR codes from URL strings. It does not allocate memory (not even on stack) and has no dependencies (not even libc), extremely small (ca. 150 SLoC), so it is perfect for micro controllers, embedded systems and on bare metal in general.
In exchange for simplicty it can only generate fixed sized images from a zero-terminated UTF-8 string. The V9 was chosen because
128 bytes of storage is reasonably large and 53 x 53 is still small enough to fit on a tiny LED or LCD screen. Byte data is needed
because you can't really encode URLs with alphanumeric (lacks ?, &, =). Error correction uses QUARTILE, mask level is 1.
If this does not suit your needs, then take a look at MiniQR or Nayuki's QR code generator.
Usage
In exactly one of your C/C++ source files, define NANOQR_IMPLEMENTATION before you include nanoqr.h.
#define NANOQR_IMPLEMENTATION
#include "nanoqr.h"
The library has only one function:
void nanoqr(unsigned char (*dst)[53], char *src);
| Parameter | Description |
|---|---|
dst[53][53] |
the output grayscale image, just 0 (foregound) or 255 (background) |
src |
the input UTF-8 string (up to 128 bytes in length) |
Examples (see also qrcode.c for usage example):
uint8_t image[53][53];
nanoqr(image, "Lorem ipsum sic dolor amet");
nanoqr(image, "https://someone.gitlab.io/human_readable_format_error?code=1234&line=123&when=123");
That would be all, simplicity is the ultimate sophistication!
License
The NanoQR library is licensed under the permissive MIT license, see LICENSE file for details.
bzt