Generate QR codes.
A standard install uses pypng to generate PNG files and can also render QR codes directly to the console. A standard install is just:
pip install qrcode
pip install image
From the command line, use the installed qr script:
qr "Some text" > test.png
import qrcode
img = qrcode.make('Some data here')
type(img) # qrcode.image.pil.PilImage
img.save("some_file.png")
For more control, use the QRCode class. For example:
import qrcode
import image
qr =qrcode.QRCode(
version=15, # 15 means the version og the qr code high the number bigger the code image and complicated picture
box_size=10, # size of the box where qr code will be displayed
border=5 # it is the white part of image -- border in all 4 sides with white color
)
data = "https://github.com/Lalith3470"
qr.add_data(data)
qr.make(fit=True)
img = qr.make_image(fill="black", back_color="white")
img.save("test.png")