'Read a QR Code Image with BLOB React JS and Python
I'm pretty new with React and Python Flask. I'm trying to read a QR Image from React Front-end, and pass it to Python Flask back end to handle decoding the image. I got the blob from React: blob:http://localhost:3000/da6af34a-b103-4212-884b-4aec8719574d. I'm trying to pass this string to python and read it; however, I'm not sure how I can read and image with blob. Any idea what I should do? Any input is appreciated. Thank you.
@api.route('/api/read_qr_code/<srcQrImg>', methods=["GET"])
def read_qr(srcQrImg):
print(srcQrImg)
img = Image.open(srcQrImg)
output = pyzbar.decode(img)
qr_data = str(output[0].data).lstrip("b'").rstrip("'")
qr_data = json.loads(qr_data)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
