-
Notifications
You must be signed in to change notification settings - Fork 0
/
Generator.py
39 lines (24 loc) · 980 Bytes
/
Generator.py
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
30
31
32
#Kritika Srivastava
#April 26, 2020
#The given code encodes a given url or information in a qrcode.
import qrcode
import PIL
from PIL import Image
qr=qrcode.QRCode(
version=1,
box_size=10,
border=5
)
# You can add a text or a file depending upon your requirement.
# Eg- data='Hello I am kritika'
data='https://github.com/kritika-srivastava'
# I added the link of my github profile....Cheers ;-)
qr.add_data(data)
qr.make(fit=True)
img=qr.make_image(fill_color="black",back_color="white")
#Choosing the foreground and background colour of the qrcode generated
#Don't forget to change the image name to a desired name. ;-)
img.save(r'C:\Users\Kritika\Desktop\VSC\python\QR-Code\images\profile_qr.png')
#Hint :Place the path of the directory in which you wamt to save the image along with its name.
#Uncomment the following line 32 to save the image in the same directory as this python file and comment line 27.
#img.save('profile_qr.png')