A few years ago, we wouldn’t have known what a QR code meant. But post-covid, anything and everything has something looking like a barcode. It has made life so easy. All you got to do is take your phone and scan the QR code, whether that be looking at a contactless menu or a digital business card.
So what next, use a couple of Python packages to create a QR code and save it as a png file. Let’s take a look.
Step 1 - Install pyqrcode
pip install pyqrcode
Step 2 - Install pypng
pip install pypng
Step 3 - Create a QR code
pyqrcode.create(link)
Step 4 - Save the code as a png file
qr_code.png(filename, scale=1, module_color=(0, 0, 0), background=None)
Note :
first argument is the destination name of the QR code that was generated
scale is how large it should be
module_color sets the color
background sets the background color
See full code here
Hope you enjoyed it!