zxing-cpp
Fast multi-format barcode reading and writing library in C++20, with Python bindings on PyPI.
Repository Health
Technical Analysis
zxing-cpp is an open-source, multi-format 1D/2D barcode image processing library written in modern C++. Originally ported from the Java ZXing library, it has since diverged with substantial performance and detection improvements, and can both decode and encode a wide range of linear and matrix symbologies such as QR Code, Data Matrix, Aztec, PDF417, EAN, UPC, and Code 128.
The PyPI zxing-cpp package provides Python bindings (built with scikit-build-core and nanobind) exposing a simple zxingcpp module: pass an image array to read_barcodes to detect and decode symbols, or call create_barcode/write_barcode to generate them. The core library is thread-safe, dependency-free, and also ships wrappers for Android, iOS, C, Go, Rust, .NET, WebAssembly, and more.
What You Get
- A
read_barcodesfunction that detects and decodes multiple barcode formats from an image array. - Barcode generation via
create_barcode/write_barcodefor supported symbologies. - Support for many formats including QR Code, Data Matrix, Aztec, PDF417, EAN/UPC, and Code 128.
- A thread-safe, dependency-free C++20 core with prebuilt Python wheels.
Common Use Cases
- Scanning QR codes or product barcodes from photos or camera frames in a Python application.
- Generating QR codes and other barcodes as images for tickets, labels, or payments.
- Batch-decoding barcodes from scanned documents or image datasets.
Under The Hood
Architecture - The C++ core lives under core/ and is split into reader and writer pipelines: shared BinaryBitmap/BitMatrix image abstractions feed per-format Reader implementations for detection and decoding, while a writer path (since 3.0 backed by the zint library) encodes symbols; language bindings under wrappers/ (Python via nanobind in wrappers/python/) expose a thin surface over this core. Tech Stack - Written in C++20 with a C++17-compatible public API, built via CMake; the Python package uses scikit-build-core and nanobind to produce wheels, and the library itself has no third-party runtime dependencies for reading. Code Quality - The project is actively maintained with CI, an extensive test/ suite, documented build instructions, and broad platform coverage; the code is modular per format and reused across many language wrappers. API Design - The Python API is deliberately compact: read_barcodes(img) returns structured results (text, format, position, content type) and create_barcode(...) plus to_image() handle generation, so common tasks take only a few lines.