code decode, string, image ... - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: code decode, string, image ... (/thread-34683.html) |
code decode, string, image ... - teckow - Aug-20-2021 This is code to decode QR image to ascii. I would like to code asci string to QR image... So i need the opposite of this code.. How can i do it ? Tnx Teckow :) #!/usr/bin/env python import sys import zlib import pprint import PIL.Image import pyzbar.pyzbar import base45 import cbor2 data = pyzbar.pyzbar.decode(PIL.Image.open(sys.argv[1])) cert = data[0].data.decode() b45data = cert.replace("HC1:", "") zlibdata = base45.b45decode(b45data) cbordata = zlib.decompress(zlibdata) decoded = cbor2.loads(cbordata) pprint.pprint(cbor2.loads(decoded.value[2])) RE: code decode, string, image ... - Yoriz - Aug-20-2021 I found the following on pypi, you could give it a try. https://pypi.org/project/qrcode/ RE: code decode, string, image ... - teckow - Aug-20-2021 hi this is the full working code.. |