Python QR Code generator

2020-06-09 Uttkarsh Kabde

Python and QR Code

Hello friends, welcome to our site.  Today we are going to learn a simple and small thing (or technology) QRCode  generation in python. QRCode is todays trending technology used to transfer data with just one image. You can use QRCode for payment like paytm, phonepay etc payment gateways.In modern life school or colleges are also using qr code attendance system.
or you can share your wifi password by simply converting password into one qrcode and pasting it onto any wall of your office where any one can scan it and get connected. There are various uses of QRCode. We are not going to discuss them all. Our today’s goal is to learn how to create qrcode  or how to generate qrcode into python and convert any string into qrcode image. So let’s start with qrcode generation . To do today’s task we need library to be installed into python. so open your terminal and execute the following command into terminal.

pip3 install qrcode


Here we need qrcode library to create and convert any text into qrcode. So get install this library. After successful installation open python3 shell by executing python3 command into command prompt and start writing code as given below


import qrcode
img = qrcode.make('')
#(output)<class 'qrcode.image.pil.PilImage'>
#(output)(330, 330)'website.png')

As here you can see we have passed as sample text to generate a simple qrcode and saved it as website.png you can choose whatever name you want to give to your image and you can choose any text you want to convert into qrcode.


After the‘website.png’) command, the qrcode will be generated at the desired directory (or here in the current working directory). Now you can you this qrcode anywhere you want to use.

For Now we will stop here. In next blog we will move forward to learn how to decode the qrcode using python. Till then try this with your own. If any error persist feel free to comment below. We will solve problem regarding this code asap.

Thank you…

Happy Coding…


About author

Card image cap
Uttkarsh Kabde

Currently I am Persuing Mtech in IT at Shri Guru Gobind Singh Institute of Engineering and Technology, Nanded!

-Web App Developer


Scroll to Top