Skip to main content

Hexatess Code 🐝

An experimental 2D barcode on a hexagonal grid — with a hexagonal bullseye finder, spiral serialization and a continuously selectable Reed-Solomon error-correction budget of 5–90 %.

Hexatess Code example

from hexatess import encode, decode, render

grid, params = encode("Hello, Hexatess!", ec_pct=30)
render(grid, "hello.png")
text, stats = decode(grid)          # ('Hello, Hexatess!', {...})

Symbol anatomy

Symbol anatomy

  • A — a real encoded symbol: hexagonal bullseye finder (rings 0–4), orientation key (ring 5: two dark cells), data region (rings 6…) filled in spiral order, and a quiet zone of at least 1 module;
  • B — finder close-up: light centre (v0.1 rule bit = ring mod 2), alternating dark/light rings, and the key — the first two canonical ring-5 cells set dark, breaking the 60-fold symmetry and marking the spiral start direction;
  • C — spiral bit order across rings 6–7 (bit 0 at cell (−6, +6)), rendered from the actual reference encoder output.

Why hexagons?

  • +15.5 % packing density over the square grid — hexagons tile the plane with ~15.5 % more modules per area at equal module size, which directly translates into more data per printed area.
  • Rotational isotropy — three axes of symmetry instead of two; damage from any direction is statistically equivalent.
  • Proven heritage — MaxiCode (UPS, ISO/IEC 16023) already proved a hexagonal 2D code works in the field; Hexatess Code generalizes the idea to variable-size, high-capacity, Aztec-style symbols.
  • Modern error control — continuous EC budget from 5 % to 90 % (not 7 discrete levels), independent RS blocks of ≤ 50 data bytes, and a double-protected header.

Status: experimental. This is a young format: the symbol specification and reference implementation are solid and heavily tested (2,500+ tests, conformance vectors), but there is no camera decoder yet — reading images assumes ideal upright sampling. See the roadmap below. Adopting a young format is a deliberate bet; the full format specification is the insurance.

Installation

pip install hexatess-code            # from PyPI (once published)
# or from a source checkout:
pip install -e .

Requires Python ≥ 3.8 and Pillow (for rendering only).

Command line

hexatess "Hello world" -o koda.png --ec 30
hexatess "Important URL https://example.org" -o url.png --ec 55
hexatess-code --demo        # demo symbol + robustness statistics

API

Function Description
encode(text, ec_pct=30, mask_id="auto", min_rings=None) UTF-8 text → (grid, params); grid maps axial (q, r) to 0/1
decode(grid) grid → (text, stats); RS-corrects transparently
render(grid, path, size_px=18, ...) grid → PNG (pointy-top hexagons, quiet zone, supersampling)
sample_grid_from_image(path, rmax, ...) ideal re-sampling of a rendered PNG (self-test helper)
run_tests(...) noise/blob robustness statistics

params / stats contain rmax (radius in rings), mask, ec, blocks (list of (data_bytes, ecc_bytes)) and data_len.

Error-correction budget

Choose any multiple of 5 between 5 and 90:

EC Character
5–15 maximum capacity, clean environments
25–40 general use (default 30)
50–70 industrial / outdoor
80–90 extreme damage tolerance

Physical behaviour (measured on the reference implementation): one flipped module is one RS symbol error, so uniform-noise tolerance is roughly EC / 16 percent of modules, while clustered (smudge/blob) damage survives several times higher area fractions because flips concentrate inside whole bytes.

Implement it in your own language

The format is deliberately specification-first: everything needed for an independent implementation is in SPECIFICATION.md, and test_vectors/vectors_v0.1.json contains fixed inputs/outputs (grids, headers, damaged symbols, expected results) to verify conformance. If your Rust/Go/JS decoder passes the vectors, it speaks Hexatess Code.

Roadmap

  1. v0.2 — camera decoding: bullseye detection + perspective correction (the critical ecosystem step).
  2. v0.2 — erasure decoding: declare blob-occluded modules as erasures → doubles correctable symbol counts.
  3. JavaScript/TypeScript SDK + online playground (generate a code in the browser in 10 seconds).
  4. Larger radii / capacity beyond 329 bytes (breaking header change).

Contributions welcome — see CONTRIBUTING.md.

License

  • Code: MIT
  • Specification: CC-BY-4.0 — implement it anywhere, commercially, under any license, no royalties, forever.

Hexatess Code stands on the shoulders of giants: Aztec Code (bullseye + spiral), MaxiCode (hexagonal lattice), QR Code and Data Matrix (Reed-Solomon practice).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hexatess_code-0.1.0.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hexatess_code-0.1.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file hexatess_code-0.1.0.tar.gz.

File metadata

  • Download URL: hexatess_code-0.1.0.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hexatess_code-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a68d1918c4bff1f198ae3c93a06252de2d7173b0681b18aa6f28f8e207179539
MD5 5135a4377bb3aa041b470e1fcf3d4b8e
BLAKE2b-256 1a61aa89c55531da813e072f5b3a34ae682734c2c6f8bb640a43a39ebb3233c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for hexatess_code-0.1.0.tar.gz:

Publisher: publish.yml on lovro-abram/hexatess-code

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hexatess_code-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hexatess_code-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hexatess_code-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f423e27c20de5da5f956f18053362ed5bc9a54c1cbc3c5c2becb64f98537aa22
MD5 fe6fdcba2b2000e63a2e7dd288a8cf27
BLAKE2b-256 bc0a66d52ca002206a79634ab000f313b48e97693fd41d69910932843f890be2

See more details on using hashes here.

Provenance

The following attestation bundles were made for hexatess_code-0.1.0-py3-none-any.whl:

Publisher: publish.yml on lovro-abram/hexatess-code

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page