Generating QR Code – Python

In this blog we will see how to generate a QR Code in Python.

QR code generation

What is a QR?

QR stands for Quick Response which is a machine-readable label or code which contains the information.

How to see the information stored in QR?

From the reference to the previous text, it is clear that QR is a machine-readable label so it will be revealed when we scan it.

In Python we can input the content and get our output let us see how.?

If we have a requirement to make a QR Code with your YouTube channel, a website or may be an application then we can simply write code in three lines and get output.

Let me show you how?.

We need to first install two modules in our python compiler.

The first one is:
pip install qrcode
Why qrcode??
This module consists of all the QR code library.

Now we will install another module.
pip install image

Why image?
Pillow or PIL is a library in Python which is used to image class within it to show the image.

Now we will start coding...
Importing:
import qrcode

Now we will make the qrcode:
img = qrcode.make("https://youtu.be/4gICorLyNhs")

Here I'm trying to store my YouTube channel link in the variable img..

Now we will save the qr code.
img.save("Channel.jpg")

After saving the qr code we need to go to the projects file and our code is ready to be scanned..

Full Code:
import qrcode
img = qrcode.make("https://youtu.be/4gICorLyNhs")
img.save("Channel.jpg")

Locating the project.
Sample Code.. Find the Image.
QRCode

Scroll to top