Skip to main content

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.

PyPI Version Python Versions License

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.

Author

jzm3 (jzm001687@outlook.com)

Project Home

Project details


Download files

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

Source Distribution

qrflex-0.2.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

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

qrflex-0.2.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

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

Hashes for qrflex-0.2.0.tar.gz
Algorithm Hash digest
SHA256 13707fc2c6ed8488812be8dfe6f10092bb08258e65c996c77d7b331c2e9e4edf
MD5 0bf9bbfd5da954e48fb443266fae7a02
BLAKE2b-256 0cf524599546777feb210903fd66cce986b4748facafb016c10e8e05f944fef4

See more details on using hashes here.

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

Hashes for qrflex-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee1451cb8e72296b3ebd398e5f36b7f5af80228745caca03bef4f649058c9412
MD5 eaacc5b8f6aa0220636fe8f17e17b606
BLAKE2b-256 fa0d8ac8a48dc14ea127e3582a4873ad1191c8bdec01c0737f0cf8c7f9b5e6e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page