Skip to content
Generates QR codes in SVG format using Python.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Generating QR codes in Python

A simple script which generates QR codes in Python. Currently works with numeric and alphanumeric modes, and supports up to and including Version 3. In time, I plan on adding Japanese support, as well as byte support, finally increasing the number of versions supported. The output of the script is in SVG format which is a scalable vector format, the code could easily be edited to export PNG images using PIL; this is something I might add at some point.


QR('H', '')

First argument is the error detection level, accepted values are 'L', 'M', 'Q' and 'H'. Second argument is the text to be encoded. Running this script will generate an SVG file, which can be opened up in any browser, an example output is below:

Input Image

Further Information:

Thonkys QR Code Tutorial is a handy site which contains many answers to common questions when trying to build your own QR code.
Wikipedia's entry on QR codes contains many useful images and some background information on QR codes.
ISO/IEC 18004:2015 is the latest version of the international specification for QR codes. I used the 2005 version, I don't think there have been many changes between the two; and the 2005 version may be easier to get hold of.

You can’t perform that action at this time.