Gumi QR density examples / 二维码密度对照 / QRコードの密度比較
2026-10-09

This experiment generates QR PNG files from an existing public URL,
then reads those saved PNGs with a different software implementation.
It does NOT test phone cameras, printing, distance, glare, blur, logos,
or any physical damage. Decoding the text does not fetch the web page.

Tested environment: macOS 27.0.1 arm64, Python 3.12.14;
qrcode 8.2, Pillow 12.3.0, zxing-cpp 3.1.1.

On macOS, with Python 3.12 installed, run in the extracted directory:
  python3.12 -m venv .venv
  .venv/bin/python -m pip install -r qr-density-requirements.txt
  .venv/bin/python qr-density-lab.py qr-density-output

The output folder contains seven PNGs and results.json:
  ecc-L/M/Q/H.png: identical payload, different error correction levels
  mask-0/1.png: identical payload, level M, different masks
  m-no-quiet-zone.png: deliberately missing the four-module quiet zone

All cases force a single 8-bit byte segment, black on white,
6 pixels/module. Regular cases retain a four-module white border.
The no-border case records the software decoder result; passing that
case is not evidence that the image meets the margin requirement.

A forced Version 1, level M, fit=False case is expected to raise
DataOverflowError; no image is generated for that invalid configuration.
The script does not silently shorten the input to make it fit.

Sources:
  https://www.qrcode.com/en/about/version.html
  https://www.qrcode.com/en/about/error_correction.html
  https://www.qrcode.com/en/howto/code.html
  https://github.com/lincolnloop/python-qrcode
  https://pypi.org/project/zxing-cpp/3.1.1/
  https://www.nayuki.io/page/qr-code-generator-library
