Create QR Code using python

                                           Create QR Code using python 


QR Code (abbreviated from Quick Response Code) is a type of two-dimensional barcode first designed for the automotive industry in Japan. It is a machine-readable optical label that contains information about the item to which it is attached. The information stored in a QR Code can be text, URL, or other data. When scanned by a QR Code reader, the data is quickly retrieved and used. QR Codes are commonly used in marketing campaigns, product packaging, and other applications.


QR Code



Create QR Code using python :


1.Install the qrcode library:

         pip install qrcode


2.Import the qrcode library in your python code

           import qrcode


3.Create a QR code object

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


4.Add data to the QR code

        qr.add_data("https://www.example.com")


5.Generate the QR code

           qr.make(fit=True)


6.Create an image from the QR code

         img = qr.make_image(fill_color="black", back_color="white")


7.Save the image:

       img.save("qr_code.png")



The full code should look like this:


import qrcode

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

  qr.add_data("https://www.example.com")

           qr.make(fit=True)

       img = qr.make_image(fill_color="black", back_color="white")

       img.save("qr_code.png")



This will create a QR code image named "qr_code.png" in the same directory as your python code.


                                                            Created By Pramod Tharu

Comments

Popular posts from this blog

Navigating the Rapid Growth of Information Technology

The Future of Search Technology

Article about Google's Ai Bard DEMO vs ChatGPT