QR Code Generator in Python

QR code used everywhere now a day. Instead of use other QR code generator services, let’s make our own QR code generator in Python. This tutorial teaches you how to make a QR code generator in Python.

So, here we are gonna use pyqrcode module. Let’s see how to generate QR code in Python using pyqrcode module.

pyqrcode module is a QR code generator. The module automates most of the building process for creating QR codes.

This module attempts to follow the QR code standard as closely as possible. The terminology and the encodings used in pyqrcode come directly from the standard.

Installation

Install pyqrcode module

pip install pyqrcode

Install an additional module pypng to save image in png format:

pip install pypng

To open Image, install Pillow module

pip install Pillow

Code

import pyqrcode
import png
from PIL import Image

s = "https://www.codesnail.com"
url = pyqrcode.create(s)

img = "codesnail-qr-code.png"
url.png(img, scale=10)

#opening image
im=Image.open(img)
im.show()

#Follow @code_snail

Output

qr code generator in python

Read more about this pyqrcode module here

Read: QR Code Reader in Python

I hope you like this QR code generator in Python. Try this code and have fun. Happy Coding 🙂

Other Pythonic Stuff 👇

Leave a Comment

Copy link
Powered by Social Snap