This repository contains the work behind my Hack Club blot submission: hackclub/blot#803.
- Scannable Art: By changing
textToEncodeyou can encode your own text - All QR Versions Supported: By changing the appropriate variables in accordance with the tables provided on Thonky's QR Tutorial, you can encode data in any version from 1 all the way up to 40. (Additionally, see the Helpful Tables section)
- Fully Customizable Presets: A preset may be selected by changing the
PRESETvariable to any integer greater than0. You can add your own presets by modifying the presets array. - Completely Random Mode: A completely random QR inspired art piece can be generated by setting
PRESETto0.
Left: snapshot-1.png which was generated with scannability in mind. Pull out your phone and try scanning it 😄
Right: snapshot-2.png which was optimized for being drawn by the blot. Most phones will identify it as a QR code, but fail to scan it.
This table may help select the correct values for the QR code constants. Here is an example:
const encodeVersion = 2; // https://www.thonky.com/qr-code-tutorial/character-capacities
const errorCorrectionLevel = "M"; // L (7%), M (15%), Q (25%), H (30%)
const requiredBits = 28 * 8; // "Data Codewords" https://www.thonky.com/qr-code-tutorial/error-correction-table
const errorCorrectionBytes = 16; // "EC Codewords Per Block" https://www.thonky.com/qr-code-tutorial/error-correction-tableA full table can be found by visiting Thonky.com's QR Tutorial.
Version (encodeVersion) |
EC Level (errorCorrectionLevel) |
Data Codewords (requiredBits * 8) |
EC Codewords (errorCorrectionBytes) |
|---|---|---|---|
| 1 | L | 19 | 7 |
| 1 | M | 16 | 10 |
| 1 | Q | 13 | 13 |
| 1 | H | 9 | 17 |
| 2 | L | 34 | 10 |
| 2 | M | 28 | 16 |
| 2 | Q | 22 | 22 |
| 2 | H | 16 | 28 |
| 3 | L | 55 | 15 |
| 3 | M | 44 | 26 |
| 3 | Q | 34 | 18 |
| 3 | H | 26 | 22 |
| 4 | L | 80 | 20 |
| 4 | M | 64 | 18 |
| 4 | Q | 48 | 26 |
| 4 | H | 36 | 16 |