python bindings for libqrencode
C Python
Switch branches/tags
Nothing to show
Pull request Compare This branch is 13 commits ahead, 2 commits behind bitly:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This fork doesn't output a PIL image, but allows accessing pixels as nested tuples, or more conveniently, draw the QR code to a cairo surface as a vector graphic. (Although it would be more space efficient as a pixel surface with nearest neighbor interpolation)

The vector generation uses a crack chain-code to generate a simpler path.

Python bindings for libqrencode using Cython

Credit and inspiration to:

  • pyqrcode (this is essentially a cleaned up version of the Encoder, eliminating all the Java dependencies)

  • libqrencode, by Fukuchi Kentaro

  • PyQrCodec, by Stefano Pedemonte

Pre-requisites on all platforms:

  • you need libqrencode somewhere in your LD path (/usr/local/lib)
  • you need qrencode.h somewhere on your include path (/usr/local/include)


$ python install



import qrencode

# to render a QR code including white quiet margin:
qrencode.render(cairo_context, size_in_cairo_units, some_string)

# to get the path with useful outlines:
qrencode.path(cairo_context, size_in_cairo_units, some_string)