Created
February 26, 2024 14:36
-
-
Save MahraibFatima/ca95b5f486f6a3097ce8621435e322b8 to your computer and use it in GitHub Desktop.
This code will decode the QR code or barcode data from the PNG image using "pyzbar" and then print the decoded data as ASCII. In this we have to replace "your_image.png" with the path to our actual PNG file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
from pyzbar.pyzbar import decode | |
image = Image.open("your_image.png") | |
decoded_objects = decode(image) | |
for obj in decoded_objects: | |
print(obj.data.decode('ascii')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment