Welcome to ZXingLight’s documentation!

ZXingLight is a simple Python wrapper for ZXing C++ inspired by zbarlight.

Table of contents

Installation

Requirements

Before installing ZXingLight, you need to:

  1. Install ZXing C++
  2. Install C++11 compatible version of g++ (>= 4.8.1)

Installing ZXing C++

Download and install ZXing C++ according to README.

Warning

Do not forget to use -DCMAKE_CXX_FLAGS=-fPIC. Otherwise, linking will fail while installing ZXingLight.

Installing ZXingLight

ZXingLight can be installed from PyPI using pip:

$ pip install zxinglight

Or using setuptools:

$ python setup.py install

Reference

class zxinglight.BarcodeType

Enumeration of barcode types supported by ZXing.

NONE = 0

Default barcode type. If used, ZXing will read all types of barcodes.

AZTEC = 1
CODABAR = 2
CODE_39 = 3
CODE_93 = 4
CODE_128 = 5
DATA_MATRIX = 6
EAN_8 = 7
EAN_13 = 8
ITF = 9
MAXICODE = 10
PDF_417 = 11
QR_CODE = 12
RSS_14 = 13
RSS_EXPANDED = 14
UPC_A = 15
UPC_E = 16
UPC_EAN_EXTENSION = 17
zxinglight.read_codes(image, barcode_type=<BarcodeType.NONE: 0>, try_harder=False, hybrid=False, multi=True)

Reads codes from a PIL Image.

Parameters:
  • image (PIL.Image.Image) – Image to read barcodes from.
  • barcode_type (zxinglight.BarcodeType) – Barcode type to look for.
  • try_harder (bool) – Spend more time trying to find a barcode.
  • hybrid (bool) – Use Hybrid Binarizer instead of Global Binarizer. For more information, see ZXing’s documentation.
  • multi (bool) – Search for multiple barcodes in a single image.
Returns:

A list of barcode values.