I have a python read a serial port and then create a QR code from this data. What I want to do is add the data used to make the QR code into the image that is generated.
qr = qrcode.QRCode(
version=1,
box_size=10,
)
data1 = arduino.readline()
shadata1 = hashlib.sha1(data1).hexdigest()
qrdata = data1 + shadata1[0] + shadata1[1] + shadata1[2] + shadata1[3] + shadata1[4] + shadata1[5]
qr.add_data(qrdata)
qr.make(fit=True)
img = qr.make_image()
img_file = "/" + data1 + ".png"
img.save(img_file, 'PNG')
So at the moment I get a QR code generated and saved,
I want to have the following
_____________
| | "Title"
| | Data1
| | "Pin Code"
| | shadata1[0] shadata1[1] shadata1[2] shadata1[3] shadata1[4] shadata1[5]
| |
|_____________|
I have no idea how I would actually carry that out.
Thanks
With the Python Image Library you can manipulate images, including adding text to them.
Note that the PIL is only available for Python 2.x. v3 support is on it’s way.