Skip to main content
fastqrcode
==========

Fast and robust Python bindings for libqrencode
(http://fukuchi.org/works/qrencode/index.en.html) using Cython

There are already several Python bindings for libqrencode (qrencode, pyqrencode
and qrkit to name a few), but as of this writing (October 2013) they all suffer
from one or more of the following issues:

- Memory leaks (not freeing or improperly freeing the QRCode object returned
by libqrencode
- Crashing instead of throwing Python exceptions in case of problems
- Inability to deal with binary data containing null characters

fastqrcode was written to solve those issues.

Usage
-----

import fastqrcode as qrcode

# Basic usage:
image = qrcode.encode("Hello World")
image.save('qrcode.png')

# More options
image = qrcode.encode("Hello World",
module_size=3, # Use 3x3 pixels for each 'dot' in the QR-code
version=20, # Make at least a version 20 QR-code
ec_level=qrcode.ERROR_CORRECT_H, # High correction level
border=5) # Keep a 5 'dots' (ie: 15 pixels) border around the code


Limitations
-----------

Currently, fastqrcode always encode in binary mode, which is less efficient if
you are encoding only alphanumeric
characters.


Installation
------------

Please make sure you have the following dependencies:

- libqrencode (OSX: `brew install libqrencode` Ubuntu: `sudo apt-get install libqrencode-dev`)
- Pillow (`pip install pillow`)

You should have libqrencode in your LD path (/usr/local/lib) and qrencode.h in
your include path (/usr/local/include)

Then, install using pip:

$ pip install fastqrcode

Alternatively, you can download the source code and install manually:

$ python setup.py install


Development
-----------

If you'd like to make changes to fastqrcode.pyx, you will need to install Cython
in order to compile the pyx file to c:

$ pip install cython
$ cython fastqrcode.pyx
$ python setup.py install

If you're submitting a pull request, please make sure that your commit has the
changes for both fastqrcode.pyx and fastqrcode.c

Release files for fastqrcode 1.0

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

Source distribution (sdist)

Source distribution for fastqrcode 1.0
File Size Uploaded
fastqrcode-1.0.tar.gz 21.8 kB Details

Release files / fastqrcode-1.0.tar.gz

Download URL fastqrcode-1.0.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f42bd11d4bfbaffcd02719334c6632b8dea3c06ffcf2e60da80dd3db9c547267
BLAKE2b-256 checksum
How to use checksums
106e735fdc64325573d727adfb4bdd5b958c8376d8697765c2a047673ce1e517
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

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