Metadata-Version: 2.4
Name: QRFlex
Version: 0.2.0
Summary: A flexible QR code generator supporting UTF-8, Kanji, and hybrid modes.
Author-email: jzm3 <jzm001687@outlook.com>
License: AGPL
Keywords: qr,qrcode,generator,kanji,utf8
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: segno>=1.6.0
Requires-Dist: pillow>=9.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: build>=0.10; extra == "dev"
Requires-Dist: twine>=4.0; extra == "dev"
Dynamic: license-file

QRFlex
======

**A flexible QR code generator that supports UTF-8, Kanji (Chinese/Japanese), and automatic hybrid encoding modes.**

.. image:: https://img.shields.io/pypi/v/qrflex.svg
   :target: https://pypi.org/project/qrflex/
   :alt: PyPI Version

.. image:: https://img.shields.io/pypi/pyversions/qrflex.svg
   :target: https://pypi.org/project/qrflex/
   :alt: Python Versions

.. image:: https://img.shields.io/pypi/l/qrflex.svg
   :target: https://opensource.org/licenses/AGPL
   :alt: 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
------------

.. code-block:: bash

   pip install QRFlex

Quick Start (Python API)
------------------------

.. code-block:: python

   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:**

.. code-block:: bash

   qrflex generate --text "Hello 世界" --output hello.png

**Generate from a text file:**

.. code-block:: bash

   qrflex generate --file my_content.txt --output my_qr.png --mode kanji --error H

**Check if content fits before generating:**

.. code-block:: bash

   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:

.. code-block:: bash

   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
------------

* PyPI: https://pypi.org/project/qrflex/
