GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - zxing-cpp/zxing-cpp: C++ port of ZXing

BranchesTags
Open more actions menu

Latest commit

 

History

3,143 Commits
3,143 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
core
core
 
 
docs
docs
 
 
example
example
 
 
test
test
 
 
wrappers
wrappers
 
 
zint @ 55541e1
zint @ 55541e1
 
 
.clang-format
.clang-format
 
 
.clang-tidy
.clang-tidy
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
CMakeLists.txt
CMakeLists.txt
 
 
Commercial Support.md
Commercial Support.md
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 
zxing-cpp.podspec
zxing-cpp.podspec
 
 
zxing.cmake
zxing.cmake
 
 

Repository files navigation

Build Status

ZXing-C++

ZXing-C++ ("zebra crossing") is an open-source, multi-format linear/matrix barcode image processing library implemented in C++.

It was originally ported from the Java ZXing library but has been developed further and now includes many improvements in terms of runtime and detection performance. It can both read and write barcodes in a number of formats. Since version 3.0 the default writing backend is provided by the zint library.

Features

  • Written in pure C++20 (public API is C++17 compatible), no third-party dependencies (for the library itself)

  • Thread safe

  • Wrappers/Bindings for:

    Android C Go
    iOS Kotlin/Native .NET
    Python Qt Rust
    WebAssembly WinRT
    External projects:
    Flutter Julia

Supported Formats

Symbology Variants
Retail: (Point-of-Sale, Coupons)
EAN/UPC EAN-13, EAN-8, EAN-5ᵂ, EAN-2ᵂ, UPC-A, UPC-E, ISBN
DataBar Omnidirectional, Stacked, Limited, Expanded, Expanded Stacked
Industrial: (Logistics, Tracking, Pharma)
Code39 Standard, Extended, PZN, Code32, (VIN, LOGMARS)
Code93
Code128
ITF ITF-14, (DHL Leitcode, DHL Identcode)
Telepen Telepen Alpha, Telepen Numeric
Matrix: (Documents, Tickets, Logistics, IDs)
Aztec Code Aztec Code, Aztec Rune
Data Matrix ECC200
MaxiCode (partial read support)
PDF417 PDF417, Compact PDF417, MicroPDF417
QR Code Model 1ᴿ, Model 2, Micro QR Code, rMQR
Other: (Legacy, Niche)
Codabar
DXFilmEdge

[Note:]

  • ᵂ : write support only
  • ᴿ : read support only
  • DataBar used to be called RSS.
  • DataBar, DX Film Edge, MaxiCode, Micro QR Code and rMQR Code are not supported for writing if the library is configured with ZXING_WRITERS=OLD.

Sponsors

If you are interested in commercial support using zxing-cpp, please have a look here.

You can sponsor this library at GitHub Sponsors.

Named Sponsors:
ArAllAll Allied Vision Konstanz GmbH
jknlsn Jake Nelson
KURZ KURZ Digital Solutions GmbH & Co. KG
Moonshine AI Moonshine AI
SAP SAP (Open Source Program Office)
Somco Software Somco Software
synedra synedra information technologies GmbH

Thanks a lot for your contribution!

Getting Started

To read barcodes:

  1. Load your image into memory (3rd-party library required).
  2. Call ReadBarcodes() from ReadBarcode.h, the simplest API to get a list of Barcode objects.

A very simple example looks like this:

#include "ZXing/ZXingCpp.h"
#include <iostream>

int main(int argc, char** argv)
{
    int width, height;
    unsigned char* data;
    // load your image data from somewhere. ImageFormat::Lum assumes grey scale image data.

    auto image = ZXing::ImageView(data, width, height, ZXing::ImageFormat::Lum);
    auto options = ZXing::ReaderOptions().formats(ZXing::BarcodeFormat::QRCode);
    auto barcodes = ZXing::ReadBarcodes(image, options);

    for (const auto& b : barcodes)
        std::cout << ZXing::ToString(b.format()) << ": " << b.text() << "\n";

    return 0;
}

To see the full capability of the API, have a look at ZXingReader.cpp.

To write barcodes:

  1. Create a Barcode object with CreateBarcodeFrom...() from CreateBarcode.h.
  2. The Barcode::symbol() can be used to get access to the bit matrix (1 module == 1 pixel, no quiet zone)
  3. Alternatively the 3 WriteBarcodeTo...() functions from WriteBarcode.h can be used to create an Image, a SVG string or a UTF-8 string representation.

A very simple example looks like this:

#include "ZXing/ZXingCpp.h"
#include <iostream>

int main(int argc, char** argv)
{
    auto barcode = ZXing::CreateBarcodeFromText("some text", ZXing::BarcodeFormat::QRCode);
    auto svg = ZXing::WriteBarcodeToSVG(barcode);

    // see also ZXing::WriteBarcodeToImage()

    std::cout << svg << "\n";

    return 0;
}

As an example for how to parameterize the process with CreatorOptions and WriterOptions, have a look at ZXingWriter.cpp.

Online API documentation

The latest API documentation can be found here: https://zxing-cpp.github.io/zxing-cpp/docs

Web Demos

  • Read barcodes
  • Write barcodes
  • Read barcodes from camera

[Note: those live demos are not necessarily fully up-to-date at all times.]

Build Instructions

These are the generic instructions to build the library on Windows/macOS/Linux. For details on how to build the individual wrappers, follow the links above.

  1. Make sure CMake version 3.21 or newer is installed.
  2. Make sure a sufficiently C++20 compliant compiler is installed (minimum VS 2019 16.10? / gcc 11 / clang 12?).
  3. See the cmake ZXING_... options to enable the testing code, python wrapper, etc.
git clone https://github.com/zxing-cpp/zxing-cpp.git --recursive --depth 1
cmake -S zxing-cpp -B zxing-cpp/build -DCMAKE_BUILD_TYPE=Release
cmake --build zxing-cpp/build --parallel --config Release

[Note: ready to use packages are available for/as vcpkg, conan, mingw, homebrew and a bunch of linux distributions.]

About

C++ port of ZXing

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

2.1k stars

Watchers

48 watching

Forks

574 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.