Comparison of Python QR Code libraries¶
Features¶
Description |
||||
---|---|---|---|---|
Library license |
||||
Library version |
6.1 |
1.2.1 |
1.6.0 |
1.3.1 |
Mode Numeric |
Yes |
Yes |
Yes |
Yes |
Mode Alphanumeric |
Yes |
Yes |
Yes |
Yes |
Mode Byte |
Yes |
Yes |
Yes |
Yes |
Mode Kanji |
No |
Yes |
Yes |
Yes |
Mode ECI |
No |
No |
Yes |
Yes |
Mode FNC1 |
No |
No |
No |
No |
Mode Structured Append |
No |
No |
No |
Yes |
Mode Hanzi 1 |
No |
No |
No |
Yes |
Mixing modes |
Yes |
No |
Yes |
Yes |
QR Codes version 1 - 40 |
Yes |
Yes |
Yes |
Yes |
Micro QR Codes version M1 - M4 |
No |
No |
No |
Yes |
Output acc. to ISO/IEC 18004:2015(E) Fig. 1 |
||||
Find maximal error correction level |
No |
No |
Yes |
Yes |
Optimize QR Codes |
Yes |
No |
No |
No |
PNG output |
Yes |
Yes |
No |
Yes |
SVG output |
Yes |
Yes |
Yes |
Yes |
EPS output |
Yes |
Yes |
No |
Yes |
PDF output |
Yes |
No |
No |
Yes |
PAM output |
No |
No |
No |
Yes |
PBM output |
Yes |
No |
No |
Yes |
PPM output |
Yes |
No |
No |
Yes |
LaTeX support |
No |
No |
No |
Yes |
XBM output |
Yes |
Yes |
No |
Yes |
XPM output |
No |
No |
No |
Yes |
PNG data URI |
No |
No (no valid URI) |
No |
Yes |
SVG data URI |
No |
No |
No |
Yes |
Text output |
Yes |
Yes |
No |
Yes |
ANSI escape code output |
Yes |
Yes |
No |
Yes |
Other output formats (i.e. JPEG) |
Yes |
No |
No |
Yes via plugin |
Black and white QR Codes |
Yes |
Yes |
Yes |
Yes |
Colored QR Codes |
Yes |
Yes |
No |
Yes |
No |
No |
No |
Yes via plugin |
|
Changing size of modules (scaling factor) |
Yes |
Yes |
No |
Yes |
Command line script |
Yes |
No |
No |
Yes |
Plugins |
No |
No |
No |
Yes |
Default encoding in Byte mode |
ISO/IEC 8859-1 or UTF-8 |
ISO/IEC 8859-1 or UTF-8 |
ISO/IEC 8859-1 or UTF-8 |
ISO/IEC 8859-1 or UTF-8 |
3rd party dependencies |
six, Pillow or Pymaging and Pymaging-PNG (Windows: colorama) |
- 1
The Hanzi mode is not part of ISO/IEC 18004 and may not be supported by all QR Code decoders. Segno uses the Hanzi mode if the user enables it explicitly, see Hanzi mode for details
- 2
Even if all libs generate the same byte output (
40 e5 15 22 04 36 f6 46 52 05 37 96 d6 26 f6 c0
), the generated QR code may look different because they choose a different mask pattern. ISO/IEC 18004:2015(E) (cf. page 7) uses mask 5, while qrcode and qrcodegen use mask 4 and PyQRCode uses mask 6. All these QR codes can be read by common QR Code readers.
Performance¶
Some performance indicators. The script benchmarks.py ran on Intel i7-8559U / CPython 3.7. Each SVG / PNG image uses a scaling factor of 10 (aside from qrcodegen which does not support any scaling).
Create a 1-M QR code¶
1-M QR code encoding “QR Code Symbol”
Create a 7-Q QR code¶
7-Q QR code encoding “QR Code Symbol”
Create a 30-H QR code¶
30-H QR code encoding “QR Code Symbol”
Create a QR code and serialize it as SVG¶
Create a QR code 1-M “QR Code Symbol” and serialize it as SVG document.
Create a QR code and serialize it as PNG¶
Create a QR code 1-M “QR Code Symbol” and serialize it as PNG image.