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

Installation

pip install QRFlex

Quick Start

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...")

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.1.1.tar.gz (16.6 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.1.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file qrflex-0.1.1.tar.gz.

File metadata

  • Download URL: qrflex-0.1.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for qrflex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b25c462a8d454a9224ca55ff881d5c769547402f34617882964fc5a037ecaab3
MD5 49eda9ac28ef66fc5ee1c740079dc1bb
BLAKE2b-256 531e677366c4ccd3bcab923fbfdbcfa91c17f767b52ffade44c63fb815031359

See more details on using hashes here.

File details

Details for the file qrflex-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: qrflex-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.4 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf97436255136b47a61d287634d5c9b2a2ff58e31af455781dc33c28bb4a55ab
MD5 07d9c79063b90baaaef96fd23bab4219
BLAKE2b-256 6a125e328adedbb8e418cd3ec194599fad2d689435fce322844d594c8c69dc36

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