| 12345678910111213 |
- import sys, zxingcpp
- from PIL import Image
- img = Image.open(sys.argv[1])
- barcodes = zxingcpp.read_barcodes(img)
- for barcode in barcodes:
- print('Found barcode:'
- f'\n Text: "{barcode.text}"'
- f'\n Format: {barcode.format}'
- f'\n Content: {barcode.content_type}'
- f'\n Position: {barcode.position}')
- if len(barcodes) == 0:
- print("Could not find any barcode.")
|