Python generates two-dimensional code using the QRCode module

Source: Internet
Author: User

QRCode official website
https://pypi.python.org/pypi/qrcode/5.1

Brief introduction
Python-qrcode is a third-party module used to generate two-dimensional code images, depending on the PIL module and the QRCode library.

Simple usage

Import= Qrcode.make ('Hello, qrcode') img.save ('  Test.png')

Advanced usage

Import= qrcode. QRCode (         version=1,         error_correction=Qrcode.constants.ERROR_CORRECT_L,         box_size =10,         border=4,) qr.add_data ('Hello, qrcode') Qr.make (Fit=True)  = qr.make_image () img.save ('123.png ')

Parameter meaning:
Version: An integer value of 1~40 that controls the size of the QR code (the minimum value is 1, which is a 12x12 matrix). If you want the program to determine automatically, set the value to None and use the Fit parameter.

Error_correction: Control the error correction function of QR code. The following 4 constants are desirable values.
error_correct_l: About 7% or fewer errors can be corrected.
Error_correct_m (default): Errors of approximately 15% or less can be corrected.
Ror_correct_h: About 30% or fewer errors can be corrected.

Box_size: Controls the number of pixels that each small lattice in the QR code contains.

Border: Control border (the distance between the QR code and the picture boundary) contains the number of squares (the default is 4, which is the minimum value specified by the relevant standard)

Python generates two-dimensional code using the QRCode module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.