Comparison of Python QR Code libraries¶
Features¶
Description | qrcode | PyQRCode | PyQRCodeNG | qrcodegen | Segno |
---|---|---|---|---|---|
Library license | BSD | BSD | BSD | MIT | BSD |
Library version | 6.1 | 1.2.1 | 1.3.6 | 1.5.0 | 0.3.5 |
Mode Numeric | Yes | Yes | Yes | Yes | Yes |
Mode Alphanumeric | Yes | Yes | Yes | Yes | Yes |
Mode Byte | Yes | Yes | Yes | Yes | Yes |
Mode Kanji | No | Yes | Yes | No | Yes |
Mode ECI | No | No | No | Yes | Yes |
Mode FNC1 | No | No | No | No | No |
Mode Structured Append | No | No | No | No | Yes |
Mixing modes | Yes | No | No | Yes | Yes |
QR Codes version 1 - 40 | Yes | Yes | Yes | Yes | Yes |
Micro QR Codes version M1 - M4 | No | No | No | No | Yes |
Output acc. to ISO/IEC 18004:2015(E) Fig. 1 [1] |
No |
No |
No |
No |
Yes |
Output acc. to ISO/IEC 18004:2015(E) Fig. 2 |
Yes |
||||
Find maximal error correction level | No | No | No | Yes | Yes |
Optimize QR Codes | Yes | No | No | No | No |
PNG output | Yes | Yes | Yes | No | Yes |
SVG output | Yes | Yes | Yes | Yes | Yes |
EPS output | Yes | Yes | Yes | No | Yes |
PDF output | Yes | No | No | No | Yes |
XBM output | Yes | Yes | Yes | No | Yes |
XPM output | No | No | No | No | Yes |
PBM output | Yes | No | No | No | Yes |
PAM output | No | No | No | No | Yes |
LaTeX support | No | No | No | No | Yes |
PNG data URI | No | No (no valid URI) | Yes | No | Yes |
SVG data URI | No | No | No | No | Yes |
Text output | Yes | Yes | Yes | No | Yes |
ANSI escape code output | Yes | Yes | Yes | No | Yes |
Other output formats (i.e. JPEG) | Yes | No | No | No | No, but via PIL plugin |
Black and white QR Codes | Yes | Yes | Yes | Yes | Yes |
Colored QR Codes | Yes | Yes | Yes | No | Yes |
Animated QR Codes (GIF, APNG) | No | No | No | No | No |
Changing size of modules (scaling factor) | Yes | Yes | Yes | No | Yes |
Command line script | Yes | No | Yes | No | Yes |
Plugins | No | 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 | ISO/IEC 8859-1 or UTF-8 |
3rd party dependencies | six, Pillow or Pymaging and Pymaging-PNG (Windows: colorama) | PyPNG | PyPNG |
[1] | 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 / PyQRCodeNG use mask 6. All these QR Codes can be read by common QR Code readers. |
Performance¶
Some performance indicators. The script benchmarks.py ran on a 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.