32 lines
734 B
Python
32 lines
734 B
Python
|
"""
|
||
|
Qr Codes
|
||
|
"""
|
||
|
|
||
|
import qrcode
|
||
|
#from pyzbar.pyzbar import decode
|
||
|
from PIL import Image
|
||
|
|
||
|
# Encode
|
||
|
#data = 'https://gitea.kickto.net/explore/repos'
|
||
|
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)
|