-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQRcode
More file actions
29 lines (25 loc) · 713 Bytes
/
QRcode
File metadata and controls
29 lines (25 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'''apt-get install libzbar0 libzbar-dev
pip install zbarlight
pip install pillow
pip install pyqrcode
pip install pypng
'''
# Importações
from PIL import Image
from os import system
import pyqrcode
import zbarlight
# Gerar QRCode
def qrcode(TextoEscrito, NomeArquivo):
qr = pyqrcode.create(TextoEscrito)
qr.png(NomeArquivo, scale=20)
return qr
TextoEscrito = input("digite seu texto de qrcode : ")
NomeArquivo = "emanuel.png"
ArquivoQRCode = qrcode(TextoEscrito, NomeArquivo)
# Ler QR Code
NomeArquivo = "qrCode.png"
ImagemEmPixels = Image.open(NomeArquivo)
ImagemEmPixels.load()
TextoQRCode = zbarlight.scan_codes(['qrcode'], ImagemEmPixels)
print('Texto contido no QR Code: %s' % TextoQRCode)