Apuntes_Python/04_seis_proyectos/06_QrCodes/main.py

32 lines
732 B
Python
Raw Permalink Normal View History

2022-12-24 22:41:20 -03:00
"""
Qr Codes
"""
import qrcode
#from pyzbar.pyzbar import decode
from PIL import Image
# Encode
#data = 'https://gitea.letz.dev/explore/repos'
2022-12-24 22:41:20 -03:00
data = 'https://gitlab.com/users/dev_fzn/projects'
img = qrcode.make(data)
#img.save('./out/qr_code.png')
img.save('./out/qr_code_gitlab.png')
qr = qrcode.QRCode(version = 1, box_size=5, border=3)
qr.add_data(data)
qr.make(fit=True)
#img = qr.make_image(fill_color = 'purple', back_color = 'cyan')
img = qr.make_image(fill_color = 'black', back_color = 'white')
#img.save('./out/qr_code_custom.png')
img.save('./out/qr_code_gitlab2.png')
# Decode
#img = Image.open('./out/qr_code_custom.png')
#img = Image.open('./out/qr_code_gitlab.png')
#lectura = decode(img)
#print(lectura)