This Python program will generate a QR code from the input text using various Python packages. and also read that generated QR code.
Firstly you have to install the following packages:
1. pyQRCode: This Python package helps to generate QR code and saved as PNG format. To install this package you have to write simple command:
![]()
2. pyzbar: This Python package helps to Read QR code using the zbar library. To install this package you have to write simple command:

3. pillow: This is a Python imaging library. To install this package you have to write simple command:

4. pypng: This Python package helps to read and write PNG images. To install this package you have to write simple command:

Then import all packages in your program.
import pyqrcode from pyzbar.pyzbar import decode from PIL import Image
pyQRCode package will convert a string into PNG type QR code. and set size using scale parameter.
qr= pyqrcode.create("Welcome to coderspacket")
qr.png("coderspacket.png",scale=10)
Then decode that QR code using pyzbar package to Read that QR code.
readqr= decode(Image.open("coderspacket.png"))
print(readqr)
Submitted by Shubham Suresh Chavan (schavanshubham)
Download packets of source code on Coders Packet
Comments