A Python-based QR code processing system that analyzes images, detects structural patterns, and decodes contained data. Generates visual annotations while supporting numeric, alphanumeric, kanji, and binary data extraction.
The following images are based on this QR code, which has the text 'hello world' embedded within it:
-
Pattern Detection
- Automatically identifies finder patterns (corners), timing patterns (alignment lines), and version/format information.
-
Visual Debugging - Generates layered SVG outputs showing:
- Original QR code
- Timing patterns (gold)
- Decoding path (color-coded)
- Format/version info areas
-
Data Decoding - Supports:
- Numeric, alphanumeric, kanji, and 8-bit byte encoding
- Error correction levels (L, M, Q, H)
- Versions 1-40 (auto-detected)
- Mask pattern reversal
- This is the unmasked QR data and error correction bits:
-
Intelligent Processing
- Dynamically calculates block sizes and handles orientation variations.
- Rotates the image based on the finder pattern positions
-
Python 3.8+
-
Pillowlibrary:pip install Pillow
-
Basic Processing
python main.py --input qr_image.png --output analysis.svg
-
Output Interpretation
- Open the resulting SVG in any modern browser
- Gold rectangles = Timing patterns
- Purple/Green rectangles = Format info
- Orange rectangles = Alignment patterns
- Colored blocks = Data decoding sequence
graph LR
A[Input Image] --> B[Pattern Detection]
B --> C[SVG Visualization]
B --> D[Grid Creation]
D --> E[Format Decoding]
E --> F[Data Extraction]
F --> G[Decoded Output]
| Feature | Support Level |
|---|---|
| Encoding Modes | Numeric, Alphanumeric, Byte, Kanji |
| Error Correction | L (7%), M (15%), Q (25%), H (30%) |
| Version Detection | 1-40 (Auto-scaled) |
| Mask Patterns | 8 standard types |
- Static image input only (no camera support)
- Currently does not include any error handling
.
├── main.py # Entry point & visualization pipeline
├── parse.py # Core detection/decoding logic
└── xmlpy.py # SVG generation utilitiesOpen-source under MIT License. Commercial use permitted with attribution.


