Skip to main content

pyquirc PyPI version

Python and C++ bindings for the quirc library, created using pybind11.

Installation

The package is on pypi, just

$ pip install pyquirc

There is an older, no longer maintained package quirc, not to be confused.

Example

# we read images using pillow, numpy arrays do also work
from PIL import Image, ImageOps
import quirc

img = Image.open("resources/helloworld.png")

# we need to convert to 8-bit grayscale for quirc
img = ImageOps.grayscale(img)

# Images must either have `tobytes()`, `width` and `height` like PIL images
# or support the 2d buffer protocal, both with data type uint8 (8-Bit Grayscale)
decoded_codes = quirc.decode(img)

print(f'Found {len(decoded_codes)} qr code(s) in the image')

for code, data in decoded_codes:
    print(code)
    print(data)

Output:

Found 1 qr code(s) in the image
Code(size=21, corners=[Point(40, 40), Point(250, 40), Point(250, 250), Point(40, 250)])
Data(payload=b'Hello, World!', version=1, data_type=DataType.BYTE, eci=ECI.UNDEFINED, ecc_level=ECCLevel.M, mask=5)

On the Command Line

This package also installs the tool pyquirc_decode, which will use pillow as above and decode the QR code in the given image.

The payloads of each decoded qr code will be printed to stdout, one per line:

$ pyquirc_decode resources/helloworld.png -v
INFO Found 1 qr code in image
INFO --- Payload 1 ---
Hello, World!

The log messages come on stderr, so piping the the output will only pipe the payloads, not the log output.

Metadata

Release files for pyquirc 0.2.0.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyquirc 0.2.0.post1
File Size Uploaded Provenance
pyquirc-0.2.0.post1.tar.gz 58.9 kB Without provenance Details

Release files / pyquirc-0.2.0.post1.tar.gz

Download URL pyquirc-0.2.0.post1.tar.gz
Size 58.9 kB
Tags Source
SHA-256 checksum
How to use checksums
91cfa5ab076b7764903b263f4362cd78fefbf1dcda3921e624d52e02123f43f5
BLAKE2b-256 checksum
How to use checksums
c69ba68a48fa3873d56380a04c498af26e679ac637376f7056697da607f99cca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for pyquirc 0.2.0.post1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0.post1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page