miniqr
Extremely minimal QR code generator (V1 - V40)
Summary
| Latest Version | Unknown |
|---|---|
| License | Unknown |
| CI Status | Failing |
| Stars | 3 |
| Forks | 0 |
| Open Issues | 0 |
| Last Commit | 2025-10-18 |
| Downloads | 0 |
| Last Indexed | 2026-07-22 05:33 |
Tags
Installation
nimble install miniqr
choosenim install miniqr
git clone https://gitlab.com/bztsrc/miniqr
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| miniqr | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://gitlab.com/bztsrc/miniqr |
|---|---|
| Homepage | https://gitlab.com/bztsrc/miniqr |
| Registry Source | gitlab |
README
MiniQR
MiniQR 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. 300 SLoC), so it is perfect for micro controllers, embedded systems and on bare metal in general.
It can generate different QR versions (1 to 40) with different pixel sizes (21 to 177) from a zero-terminated UTF-8 string (up to
1663 bytes). If this is too much, see NanoQR which only generates 53 x 53 pixels and accepts
strings up to 128 bytes. Byte data is needed because you can't really encode URLs with alphanumeric (lacks ?, &, =). Error
correction uses QUARTILE, mask is selected by calculating penalty score.
If this still does not suit your needs, then take a look at Nayuki's QR code generator.
Usage
In exactly one of your C/C++ source files, define MINIQR_IMPLEMENTATION before you include miniqr.h.
#define MINIQR_IMPLEMENTATION
#include "miniqr.h"
The library has only one public function:
int miniqr(unsigned char *dst, char *src);
| Parameter | Description |
|---|---|
dst |
the output grayscale image, just 0 (foregound) or 255 (background) |
src |
the input UTF-8 string (up to 1663 bytes in length) |
The destination buffer must be big enough to hold the entire image (maximum 177 x 177 bytes). Returns the generated image's width
(same as height) in pixels. If dst is NULL, then it just returns how big the image would be. If MINIQR_MINVER is defined (1
to 39) then it will never generate smaller QR codes than that ((version - 1) * 4 + 21 pixels).
Examples (see also qrcode.c for usage example):
uint8_t image[177 * 177];
int wh = miniqr(image, "https://someone.gitlab.io/human_readable_format_error?code=1234&line=123");
That would be all, simplicity is the ultimate sophistication!
License
The MiniQR library is licensed under the permissive MIT license, see LICENSE file for details.
bzt