Create Personalized QR code using Python




  • What is a QR Code?
  •            “Personalised QR code using Python”.A Quick Response code is a two-dimensional pictographic code used for its fast readability and comparatively large storage capacity. The code consists of black modules arranged in a square pattern on a white background. The information encoded can be made up of any kind of data.
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.
          First of all, you should know that there is a library in Python called “pyrqcode” which instantly develops R codes from the data you provide. These ready to install packages are developed by some contributors and Python developers. 

$ pip install pyqrcode 

By doing this, you can instantly install the package and is ready for our use. Follow up to create it……….
The Python 3.x code is explained below step-by-step blockwise.

Block-1

import pyqrcode 

from pyqrcode import QRCode 
By doing this on your Python IDE, you are calling in the installed package “pyrcode” to your work. This step is as simple as so.

Block-2

s = "YOUR PERSONALISED INFO/url link"
         Here you are going to tell your personalised data to Python library so that it can get QR ready for you. You can give any string data. It can be url, your contact number, Facebook page link, Instagram profile or anything like so.

Block-3

url = pyqrcode.create(s)
url.svg("MY_CUSTOM_QR.svg", scale = 8) 
          Here, this is a simple step of giving command to obtain the R code By typing this command, you are asking it to get your personalised QR code ready in a .png format with declared scale and size to save it in your machine.
The following is the full code for the QR ode generation
# Import QRCode from pyqrcode 
import pyqrcode 
from pyqrcode import QRCode 
  
  
# String which represent the QR code 
s = "YOUR PERSONALISED INFO/url link"
  
# Generate QR code 
url = pyqrcode.create(s) 
  
# Create and save the png file naming "MY_CUSTOM_QR.png" 
url.svg("MY_CUSTOM_QR.svg", scale = 8) 

Output/Results


The following is the QR generated by the above code.





Python Code





QR code

Hope this helps................any queries, just drop it below on comments or direct here
Cheers!!!
** THE CONENTS HERE ARE ARCHIVES FROM  www.pythonpool.com  AND PYTHONPOOL OWNS ITS COPYRIGHT TOO.

Comments

Popular posts from this blog

Infineon IFX007T BLDC Shield + XMC4700 Relax Kit + Nanotec BLDC Motor RoadTest

MicroPython #2: Triggering I/O's