Python qrcode.ERROR_CORRECT_M Examples

The following are 5 code examples of qrcode.ERROR_CORRECT_M(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module qrcode , or try the search function .
Example #1
Source File: christmas.py    From ppci with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def make_qr_data(text):
    qr_image = qrcode.make(
        text, box_size=1, border=0,
        error_correction=qrcode.ERROR_CORRECT_M)
    qr_pet = []
    print(qr_image.size)
    for y in range(25):
        for x in range(40):
            pattern = (
                get_pix(qr_image, x*2, y*2),
                get_pix(qr_image, x*2+1, y*2),
                get_pix(qr_image, x*2, y*2+1),
                get_pix(qr_image, x*2+1, y*2+1),
            )
            p = charmap[pattern]
            qr_pet.append(p)
    return bytes(qr_pet) 
Example #2
Source File: optical_codes.py    From gdshelpers with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, origin, data, box_size, version=None, error_correction=ERROR_CORRECT_M, border=0,
                 alignment='left-bottom'):
        self._qr_code = qrcode.QRCode(image_factory=ShapelyImageFactory, error_correction=error_correction,
                                      border=border, box_size=1, version=version)
        self._qr_code.add_data(data)
        self._alignment = Alignment(alignment)

        self.box_size = box_size
        self.origin = origin 
Example #3
Source File: optical_codes.py    From gdshelpers with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _example():
    qr_code = QRCode([0, 0], 'A0.0', 1.0, version=1, error_correction=QRCode.ERROR_CORRECT_M)

    from gdshelpers.geometry.chip import Cell

    device = Cell('test')
    device.add_to_layer(1, qr_code)

    device.show()

    chip = Cell('optical_codes')
    chip.add_cell(device)
    chip.start_viewer()
    chip.save() 
Example #4
Source File: views.py    From bctip with MIT License 5 votes vote down vote up
def qrcode_view(request, key):
    wallet = get_object_or_404(Wallet, key=key)
    img = qrcode.make(
        wallet.bcaddr_uri, box_size=6, error_correction=qrcode.ERROR_CORRECT_M)
    output = StringIO.StringIO()
    img.save(output, "PNG")
    c = output.getvalue()
    return HttpResponse(c, content_type="image/png") 
Example #5
Source File: tasks.py    From bctip with MIT License 5 votes vote down vote up
def qrcode_img(text):
    img = qrcode.make(text, box_size=2, error_correction=qrcode.ERROR_CORRECT_M)
    output = StringIO.StringIO()
    img.save(output, "PNG")
    c = output.getvalue()
    return c