Hi ππ
In this post, I will show you how to decode QR code in Python using a library called pyzbar.
step 1
install pyzbar pip install pyzbar
step 2
Generate qrcode
import pyqrcode
qr = pyqrcode.create('123')
qr.png('test.png', scale=6)
Now we have a qrcode image for the test
step 3
Write decoder script
from pyzbar.pyzbar import decode
from PIL import Image
result = decode(Image.open('test.png'))
print(result)
Result :
[Decoded(data=b'123', type='QRCODE', rect=Rect(left=24, top=24, width=126, height=126), polygon=[Point(x=24, y=24), Point(x=24, y=150), Point(x=150, y=150), Point(x=150, y=24)], quality=1, orientation='UP')]
Now we're done π€
Don't forget to like and follow π
For more information
https://pypi.org/project/pyzbar/