Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/zxing-cpp/wrappers/python/demo_reader.py @ 3:2c135c81b16c
MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:44:09 +0200 |
| parents | b50eed0cc0ef |
| children |
comparison
equal
deleted
inserted
replaced
| 0:6015a75abc2d | 3:2c135c81b16c |
|---|---|
| 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.") |
