Create and read QR code

QR codes are machine readable 2 dimensional pixelated barcodes which can be used to store some information. 
QR = quick response

Let see some of usecase. 

1. online payments
2.  check hotel menu,
3. wifi password sharing 

People carry their mobile all the time, it's part of life now. QR provide option to scan a code and get information in your mobile. Is it cool. 

Steps to generate QR code. 

Install qrcode package using below command. 

pip install qrcode

Code to create QR code. 
import qrcode

qr_code = qrcode.make('Hi, I am from Code Adhyayana team.'  )

qr_code.save('intro_qr.png')


Additional properties of qrcode module.
1. Version : there are 40 version available, starting from smallest 1 to largest 40.

2. error_correction : ERROR_CORRECT_L, M, Q, H

3. box_size
4. border
5. add data
6. make
7 . make image

qr_object = qrcode.QRCode(
    version=2,
    error_correction=qrcode.constants.ERROR_CORRECT_L,
    box_size=12,
    border=8,
)
qr_object.add_data("Hi, I am from Code Adhyayana team.")
qr.make(fit=True)
img = qr.make_image(fill_color="red", back_color="black")
img.save("intro.png")

Comments

Popular posts from this blog

\r issue in shell script

Create QR code using qrcode in python

Git Command