Skip to main content

Fast and robust bindings for libqrencode

Project description

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

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

fastqrcode-1.0.tar.gz (21.8 kB view details)

Uploaded Source

File details

Details for the file fastqrcode-1.0.tar.gz.

File metadata

  • Download URL: fastqrcode-1.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fastqrcode-1.0.tar.gz
Algorithm Hash digest
SHA256 f42bd11d4bfbaffcd02719334c6632b8dea3c06ffcf2e60da80dd3db9c547267
MD5 88eb776d7da3bf7502735982fd648647
BLAKE2b-256 106e735fdc64325573d727adfb4bdd5b958c8376d8697765c2a047673ce1e517

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