banner



How To Create A Qr Code For Teachers

Feed your curiosity

How to create your own QR code programmatically

QR code is quite popular today. We see them everywhere. Ever curious how QR code works and how we can create them?

Donald Le

Photo by Hillary Black on Unsplash

Standing for "Quick Response code", QR code is a code that is quickly readable by a cell phone (taking only 1–2 seconds to be processed). It has a wide range of uses across all types of industries such as retail, marketing, and logistics. QR code is a type of matrix barcode (or two-dimensional barcode) first designed in 1994 for the automotive industry in Japan, that used four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to store data efficiently (extensions may also be used). When we look at it, we see black squares arranged in a square grid on a white background, which can be read by an imaging device such as a camera, and processed using Reed–Solomon error correction until the image can be appropriately interpreted. The required data is then extracted from patterns that are present in both horizontal and vertical components of the image.

While QR Codes and Barcodes are similar in practice, QR Codes contain more information because they have the ability to hold information both horizontally and vertically. Barcodes only use horizontal information. While Barcodes work wonderfully for situations like scanning supermarket items, QR Codes have a much higher capability of transferring information, likely what has made them increasingly popular due to their versatility.

So how do we create QR-code

An easy approach would be to go to a website or mobile application that has the functionality support users to create QR code. The sites or mobile application can be :

  • The QR-code generator

The QR-code generator QR
  • QR code generator Android App

QR-code generator for Android

Or if you are curious like me, we can create QR code programmatically in any Programming Languages. For this demonstration, we will create a QR code in Python. Below is what we need to prepare:

  • Python3
  • Any Code Editor / IDE
  • Python Virtual Environment (venv)
  • QR-code library in Python

After creating our Python Project, we will need to install QRcode library (we will also need to install pillow)

            pip install qrcode
pip install Pillow
  • We can create directly a QR code from the command line. For example
            qr "https://medium.com/@ledinhcuong99" > medium-personal-link.png          

Will create the QR code like

Medium-personal-link QR code
  • Or if we want to have more control over what the QR code will be, we can customize some information.
Test generate QR code with color

The version parameter is an integer from 1 to 40 that controls the size of the QR Code (the smallest, version 1, is a 21x21 matrix). Set to None and use the fit parameter when making the code to determine this automatically.

fill_color and back_color can change the background and the painting color of the QR, when using the default image factory.

The error_correction parameter controls the error correction used for the QR Code. The following four constants are made available on the QRcode package:

            ERROR_CORRECT_L About 7% or less errors can be corrected. ERROR_CORRECT_M (default) About 15% or less errors can be corrected. ERROR_CORRECT_Q About 25% or less errors can be corrected. ERROR_CORRECT_H. About 30% or less errors can be corrected.          

The box_size parameter controls how many pixels each "box" of the QR code is.

The border parameter controls how many boxes thick the border should be (the default is 4, which is the minimum according to the specs).

Running the above code will generate the QR code looks like :

QR code with color

Conclusion

We went over some brief history about QR code and how it's made. QR code is very convenient and easy to use today. So next time you want to share something with your audience, please consider it.

Thanks for reading my post.

Peace ~~~

References

How To Create A Qr Code For Teachers

Source: https://codeburst.io/how-to-create-your-own-qr-code-programmatically-7b7290252b15

Posted by: pullenmrseach.blogspot.com

0 Response to "How To Create A Qr Code For Teachers"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel