Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zxing-cpp/wrappers/python/demo_reader.py @ 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 import sys, zxingcpp | |
| 2 from PIL import Image | |
| 3 | |
| 4 img = Image.open(sys.argv[1]) | |
| 5 barcodes = zxingcpp.read_barcodes(img) | |
| 6 for barcode in barcodes: | |
| 7 print('Found barcode:' | |
| 8 f'\n Text: "{barcode.text}"' | |
| 9 f'\n Format: {barcode.format}' | |
| 10 f'\n Content: {barcode.content_type}' | |
| 11 f'\n Position: {barcode.position}') | |
| 12 if len(barcodes) == 0: | |
| 13 print("Could not find any barcode.") |
