This is the source code for the QR Code generator in python using qrcode and pillow packages. It takes user input (text/link) and saves the QR code for that input in png format.
A QR Code or a Quick Response code is a two-dimensional code containing a grid of minuscule squares. It is mostly used over traditional bar code because of its comparatively large data/information storage capacity and fast readability. The source code for the QR Code generator in python uses qrcode and pillow packages.
The source code takes user input (text/link) and saves the generated QR code in PNG format.
The code specifies parameters of qrcode functions like version, border, box_size, and error_correction. The 'version' parameter defines the size of the QR code generated. The 'box_size' parameter controls the number of pixels in each box. The 'border' parameter is used to define how thick the border should be (minimum default is 4). The 'error_correction' parameter is used to control the error correction in QR code generation.
"ERROR_CORRECT_L" - About 7% or less errors can be corrected.
"ERROR_CORRECT_M" - About 15% or less errors can be corrected. (default)
"ERROR_CORRECT_Q" -About 25% or less errors can be corrected.
"ERROR_CORRECT_H" - About 30% or less errors can be corrected.
The method add_data is used to pass the user input and make_image function is used to define the specifications like fill and background color for the generated QR code.
At last, the save function is used to store the generated QR code image as .png file.