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.


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


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

#Follow @code_snail


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 👇

Support CodeSnail

If you appreciate my work, or if it has helped you along your journey. It would mean a lot to me if you could write a message on my wall and share a cup of coffee (or tea) with me.

Buy Me A Coffee
Your subscription could not be saved. Please try again.
Your subscription has been successful.


Subscribe to our newsletter and stay updated.

Leave a Comment