comparison mupdf-source/thirdparty/zxing-cpp/wrappers/python/README.md @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 # Python bindings for zxing-cpp
2
3 [![PyPI](https://img.shields.io/pypi/v/zxing-cpp.svg)](https://pypi.org/project/zxing-cpp/)
4
5
6 ## Installation
7
8 ```bash
9 pip install zxing-cpp
10 ```
11 or
12
13 ```bash
14 python setup.py install
15 ```
16
17 **Note**: To enable position independent and multi-symbol DataMatrix detection, the library needs to be compiled with a c++20 compiler. Unfortunately some build environments (currently the 32-bit builds for Linux) used by `cibuildwheel` to generate the binary wheels that are published on [pypi.org](https://pypi.org/project/zxing-cpp/) don't include a c++20 compiler. Best chance to enable proper DataMatrix support in that case is by installing from source:
18
19 ```bash
20 pip install zxing-cpp --no-binary zxing-cpp
21 ```
22
23 In that case or if there is no pre-build wheel available for your platform or python version or if you use `setup.py` directly, a suitable [build environment](https://github.com/zxing-cpp/zxing-cpp#build-instructions) including a c++ compiler is required.
24
25
26 ## Usage
27
28 ```python
29 import cv2, zxingcpp
30
31 img = cv2.imread('test.png')
32 barcodes = zxingcpp.read_barcodes(img)
33 for barcode in barcodes:
34 print('Found barcode:'
35 f'\n Text: "{barcode.text}"'
36 f'\n Format: {barcode.format}'
37 f'\n Content: {barcode.content_type}'
38 f'\n Position: {barcode.position}')
39 if len(barcodes) == 0:
40 print("Could not find any barcode.")
41 ```
42
43 To get a full list of available parameters for `read_barcodes` and `write_barcode` as well as the properties of the Barcode objects, have a look at the `PYBIND11_MODULE` definition in [this c++ source file](https://github.com/zxing-cpp/zxing-cpp/blob/master/wrappers/python/zxing.cpp).