treepoem
Barcode rendering for Python supporting QRcode, Aztec, PDF417, I25, Code128, Code39 and many more types.
What it is and what it does
Treepoem is a Python barcode renderer that wraps the BWIPP (Barcode Writer in Pure PostScript) library and the Ghostscript command-line tool to generate barcode images. It returns barcodes as image objects, making them easy to manipulate or save. The package supports approximately 100 barcode types including QR codes, Aztec codes, PDF417, Code128, Code39, and Interleaved 2 of 5, each configurable via BWIPP options.
The package is designed for developers who need to generate barcodes programmatically in Python applications. It provides both a Python API (the `generate_barcode()` function) and a command-line interface. The main constraint is that Ghostscript must be installed separately on your system; the package itself has only one runtime dependency (pillow) and supports Python 3.9 to 3.14. There is a known rendering issue with certain Ghostscript versions (9.22+), though Ghostscript 9.26 and later generally work.
Use it for:
- Generate QR codes for URLs or contact information in web applications or documents.
- Create product barcodes (Code128, Code39) for inventory or point-of-sale systems.
- Batch-generate multiple barcode types with different error-correction levels or options.
- Embed barcodes in reports or documents by saving generated images to files.
- Build command-line tools to generate barcodes from the shell without writing Python code.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates barcodes and QR codes as image objects by wrapping the BWIPP library and Ghostscript, supporting QR codes, Aztec, PDF417, Code128, Code39, and many other barcode types.
Yes, if you need to generate barcodes in Python and can install Ghostscript on your system. The package is actively maintained, has low Python-level install friction, and supports a wide range of barcode types. The main gotcha is the external Ghostscript dependency and known rendering quirks with older Ghostscript versions—verify compatibility with your target Ghostscript version before deploying.
Install
treepoem on PyPI
pip
pip install treepoemuv
uv add treepoempoetry
poetry add treepoemInstalling treepoem
Before you install
Low install friction with a single runtime dependency (pillow). Active maintenance with recent commits; however, requires Ghostscript to be installed separately on the system—a system-level dependency that must be handled outside pip.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects.
Quickstart
import treepoem
image = treepoem.generate_barcode(
barcode_type="qrcode",
data="https://example.com",
)
image.save("barcode.png")
Ghostscript must be installed on the system (e.g., apt-get install ghostscript on Ubuntu/Debian, brew install ghostscript on macOS). Ghostscript 9.26+ recommended to avoid rendering issues.
Verify before relying
- Whether the known smearing issue with Ghostscript 9.22+ affects your specific barcode types or use case.
- Performance characteristics when generating large batches of barcodes.
- Full range of image manipulation options available through the returned image object.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pillow |
| Maintenance | actively maintained — 339 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,103,710/month — #4,366 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: treepoem-3.28.0-py3-none-any.whl
Keywords: barcode, bwipp, postscript, ghostscript, qr, qrcode, aztec, azteccode, pdf417, interleaved2of5, i25, code128, code39
Tags
More Graphics packages
Pillow adds image processing capabilities to…
permissive · top 100 on PyPI
fonttoolsfonttools manipulates font files in multiple…
permissive · top 1,000 on PyPI
matplotlib-inlineEnables matplotlib figures to display inline…
permissive · top 1,000 on PyPI
pymupdfPyMuPDF extracts, renders, converts, and…
agpl · top 1,000 on PyPI
pypdfium2pypdfium2 is a Python binding to PDFium that…
permissive · top 1,000 on PyPI
altairAltair is a declarative Python library for…
permissive · top 1,000 on PyPI
ghostscriptProvides a Python interface to the Ghostscript…
copyleft · top 15,000 on PyPI
pyStrichpyStrich generates 1D and 2D barcodes (Code 39,…
permissive · top 15,000 on PyPI
pdf417genEncodes text and binary data into PDF417 2D…
permissive · top 15,000 on PyPI
pyzxingDecode barcodes and QR codes from images or…
permissive · top 15,000 on PyPI
pyzbarDecodes one-dimensional barcodes and QR codes…
permissive · top 5,000 on PyPI
qrcodeGenerates QR codes as images (PNG, SVG) or…
permissive · top 1,000 on PyPI
zxing-cppReads and writes barcodes and QR codes in…
permissive · top 5,000 on PyPI
PyQRCodePyQRCode generates QR codes in pure Python and…
permissive · top 15,000 on PyPI
django-qr-codeGenerates QR codes as embedded SVG or PNG…
permissive · top 15,000 on PyPI
biipBiip parses and interprets data encoded in…
permissive · top 15,000 on PyPI