0% found this document useful (0 votes)
23 views1 page

Generate QR Code with Python Code

The document shows how to generate a QR code in Python using the qrcode and PIL libraries. It demonstrates how to encode data, generate the QR code, create an image from the code, and save the image file.

Uploaded by

lanrefakorede9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views1 page

Generate QR Code with Python Code

The document shows how to generate a QR code in Python using the qrcode and PIL libraries. It demonstrates how to encode data, generate the QR code, create an image from the code, and save the image file.

Uploaded by

lanrefakorede9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd

import qrcode

from PIL import Image

#The data you want to encode in the QR code


data = https://example.com”

#generate QR code

qr = qrcode.QRCode(version=1, box_size=10, border=5)


qr.add_data()
qr.make(fit=true)

#create an image from the qr code

image = qr.make_image(fill=“black” , back_color=“white”)

#save the image


image.save(“qr_code.png”)
image.open (“qr_code.png”)

You might also like