A flexible QR code generator supporting UTF-8, Kanji, and hybrid modes.
Project description
A flexible QR code generator that supports UTF-8, Kanji (Chinese/Japanese), and automatic hybrid encoding modes.
Features
Three encoding modes: UTF‑8 (byte), Kanji (efficient for CJK characters), and Auto (smart hybrid)
Pre‑check capacity before generation to avoid overflow
Supports plain text or `.txt` file input
Output as PNG or SVG (via segno)
Returns PIL Image for further processing
Full-featured command-line interface for easy use
Installation
pip install QRFlex
Quick Start (Python API)
from QRFlex import QRMaker
# Create generator with auto mode and low error correction
maker = QRMaker(mode='auto', error='L')
# Generate from text and save to file
maker.from_text("Hello 世界", output="hello.png")
# Or from a .txt file
maker.from_file("my_content.txt", output="my_qr.png")
# Check capacity first
info = maker.check_capacity("Your long text...")
if info['can_fit']:
img = maker.from_text("Your long text...")
Command-Line Interface (CLI)
After installation, you can use the qrflex command in your terminal.
Generate a QR code from text:
qrflex generate --text "Hello 世界" --output hello.png
Generate from a text file:
qrflex generate --file my_content.txt --output my_qr.png --mode kanji --error H
Check if content fits before generating:
qrflex check --text "Your long text..." --mode auto
Options:
–mode : utf8, kanji, auto (default: auto)
–error : L, M, Q, H (default: L)
–scale : integer (default: 10)
–check-only : only check capacity, do not generate (for generate command)
For full help:
qrflex --help
Modes
Mode |
Description |
|---|---|
utf8 |
Standard byte encoding – safest, supports all characters but uses 3 bytes per Chinese char. |
kanji |
Efficient CJK encoding – uses 13 bits per character, but only supports JIS X 0208 characters. |
auto |
Recommended – automatically segments content into the most compact encoding (numbers, letters, kanji). |
Error Correction Levels
L – 7% recovery
M – 15% recovery
Q – 25% recovery
H – 30% recovery (smallest data capacity)
License
This project is licensed under the AGPL License - see the LICENSE file for details.
Project Home
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qrflex-0.2.0.tar.gz.
File metadata
- Download URL: qrflex-0.2.0.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13707fc2c6ed8488812be8dfe6f10092bb08258e65c996c77d7b331c2e9e4edf
|
|
| MD5 |
0bf9bbfd5da954e48fb443266fae7a02
|
|
| BLAKE2b-256 |
0cf524599546777feb210903fd66cce986b4748facafb016c10e8e05f944fef4
|
File details
Details for the file qrflex-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qrflex-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee1451cb8e72296b3ebd398e5f36b7f5af80228745caca03bef4f649058c9412
|
|
| MD5 |
eaacc5b8f6aa0220636fe8f17e17b606
|
|
| BLAKE2b-256 |
fa0d8ac8a48dc14ea127e3582a4873ad1191c8bdec01c0737f0cf8c7f9b5e6e3
|