Python barcode libraries

Updated Nov 2026

Python barcode libraries generate barcode and QR code images and decode them from photos or scans. A generator encodes the data as bars or modules and writes the result to SVG, PNG, or PDF. These libraries let inventory, ticketing, and shipping systems print and scan codes from Python.

Popularity

qrcode has the most monthly downloads among dedicated barcode and QR code libraries in this comparison, at 36.5M.

LibraryMonthly downloadsStarsLast releaseLicense
ReportLab
91.2M
88Oct 2026BSD
opencv-python-headless
64.1M
5.5KNov 2026Apache 2.0
qrcode
36.5M
5.0KMay 2025BSD
Segno
12.2M
823Mar 2025BSD-3-Clause
zxing-cpp
5.9M
2.1KJul 2026Apache-2.0
pyzbar
3.0M
831Mar 2022MIT
python-barcode
2.8M
659Aug 2025MIT
PyQRCode
1.7M
428Jun 2016BSD
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Provides the ReportLab PDF toolkit.

Downloads / mo
91.2M
Stars
88
Last release
5.1.0
License
BSD

Quickstart

From __init__.py
$ pip install reportlab
from reportlab.graphics.barcode import createBarcodeDrawing

drawing = createBarcodeDrawing('Code128', value='ABC123')
svg = drawing.asString('svg')

opencv-python-headless

Wraps the OpenCV Python bindings.

Downloads / mo
64.1M
Stars
5.5K
Last release
5.1.0.95
License
Apache 2.0

Quickstart

From README.md
$ pip install opencv-python-headless
import cv2

image = cv2.imread('barcode.png')
detector = cv2.QRCodeDetector()
text, points, straight = detector.detectAndDecode(image)

opencv-python-headless examples

From open-source projects on GitHub

Generates QR code images.

Downloads / mo
36.5M
Stars
5.0K
Last release
8.2
License
BSD

Quickstart

From README.rst
$ pip install "qrcode[pil]"
import qrcode
image = qrcode.make('Hello, world!')
image.save('qr.png')

qrcode examples

From open-source projects on GitHub

Generates QR codes and Micro QR codes.

Downloads / mo
12.2M
Stars
823
Last release
1.6.6
License
BSD-3-Clause

Quickstart

From README.rst
$ pip install segno
import segno
qr = segno.make_qr('Hello, world!')
qr.save('qr.png', scale=5)

Segno examples

From open-source projects on GitHub

Provides Python bindings for reading and generating barcode images with ZXing-C++.

Downloads / mo
5.9M
Stars
2.1K
Last release
3.1.1
License
Apache-2.0

Strengths

  • Reads and writes barcodes. Decode image data or construct a barcode for rendering.
  • Accepts multiple image containers. Read OpenCV, Pillow, Qt, or supported array buffers.

Limitations

  • Color arrays default to BGR. Convert RGB arrays or declare their memory layout with ImageView.

Quickstart

From README.md
$ pip install zxing-cpp
import zxingcpp

barcode = zxingcpp.create_barcode('Hello, world!', zxingcpp.BarcodeFormat.QRCode)

zxing-cpp examples

From open-source projects on GitHub

Reads linear barcodes and QR codes through the ZBar library.

Downloads / mo
3.0M
Stars
831
Last release
0.1.9
License
MIT

Strengths

  • Returns barcode locations. Use rectangle and polygon coordinates alongside each decoded payload.
  • Accepts common image objects. Decode Pillow images, image arrays, or raw pixel buffers.

Limitations

  • Unix systems need ZBar installed. Install the shared library separately on non-Windows systems.
  • Bundled Windows builds omit orientation. Bundled Windows DLLs cannot report barcode orientation.

Quickstart

From README.rst
$ pip install pyzbar pillow
from PIL import Image
from pyzbar.pyzbar import decode

results = decode(Image.open('barcode.png'))

pyzbar examples

From open-source projects on GitHub

Generates barcodes with vector and optional raster image writers.

Downloads / mo
2.8M
Stars
659
Last release
0.16.1
License
MIT

Strengths

  • Creates SVG without external dependencies. Generate scalable barcode artwork without installing an image engine.
  • Calculates checksums automatically. Supply the barcode value without calculating its checksum yourself.

Limitations

  • Raster output needs Pillow. Install the images extra before generating raster images.

Quickstart

From getting-started.rst
$ pip install python-barcode
from io import BytesIO
from barcode import EAN13

output = BytesIO()
EAN13('100000902922').write(output)

python-barcode examples

From open-source projects on GitHub

Generates QR codes in pure Python with SVG, EPS, PNG, and terminal output.

Downloads / mo
1.7M
Stars
428
Last release
1.2.1
License
BSD

Quickstart

From moddoc.html
$ pip install pyqrcode
import pyqrcode
qr = pyqrcode.create('Hello, world!')
qr.svg('qr.svg', scale=4)

PyQRCode examples

From open-source projects on GitHub

FAQ

python-barcode suits generating linear barcodes such as EAN and UPC. Segno and qrcode suit QR codes. zxing-cpp suits reading and writing many barcode formats from one package.

Segno generates QR codes and Micro QR codes in pure Python. It writes SVG, PNG, and other formats with no extra dependencies.

Install qrcode or Segno, pass the text or URL, and save the result as an image. Both control error correction and module size.

pyzbar reads linear barcodes and QR codes from images through the ZBar library. It needs the ZBar shared library installed on the system.

python-barcode generates EAN, UPC, and other linear barcodes as SVG or, with Pillow, as raster images.

For coding agents

Found your barcode library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official