我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用qrcode.ERROR_CORRECT_M。
def prn_qr(self, text, *args, **kwargs): """ Print QR Code for the provided string """ qr_args = dict( version=4, box_size=5, border=1, error_correction=qrcode.ERROR_CORRECT_M ) qr_args.update(kwargs) qr_code = qrcode.QRCode(**qr_args) qr_code.add_data(text) qr_code.make(fit=True) qr_img = qr_code.make_image() im = qr_img._img.convert("RGB") self._print_image(im,1,0)
def prn_qr(self, text, *args, **kwargs): """ Print QR Code for the provided string """ qr_args = dict( version=4, box_size=4, border=1, error_correction=qrcode.ERROR_CORRECT_M ) qr_args.update(kwargs) qr_code = qrcode.QRCode(**qr_args) qr_code.add_data(text) qr_code.make(fit=True) qr_img = qr_code.make_image() im = qr_img._img.convert("RGB") return self.print_image(im)
def qr(self, text,size, *args, **kwargs): """ Print QR Code for the provided string """ qr_args = dict( version=4, box_size=size, border=1, error_correction=qrcode.ERROR_CORRECT_M ) qr_args.update(kwargs) qr_code = qrcode.QRCode(**qr_args) qr_code.add_data(text) qr_code.make(fit=True) qr_img = qr_code.make_image() im = qr_img._img.convert("RGB") # Convert the RGB image in printable image self._convert_image(im)
def create_qrcode(data='QR Code Symbol'): """qrcode create""" qr = QRCode(error_correction=ERROR_CORRECT_M) qr.add_data(data, optimize=False) qr.make()
def svg_qrcode_path(data='QR Code Symbol'): """qrcode SVG path""" qr = QRCode(error_correction=ERROR_CORRECT_M, box_size=10, image_factory=SvgPathImage) qr.add_data(data, optimize=False) qr.make_image().save('out/qrcode_path_%s.svg' % data)
def svg_qrcode_rects(data='QR Code Symbol'): """qrcode SVG rects""" qr = QRCode(error_correction=ERROR_CORRECT_M, box_size=10, image_factory=SvgImage) qr.add_data(data, optimize=False) qr.make_image().save('out/qrcode_rects_%s.svg' % data)
def png_qrcode(data='QR Code Symbol'): """qrcode PNG""" qr = QRCode(error_correction=ERROR_CORRECT_M, box_size=10) qr.add_data(data, optimize=False) qr.make_image().save('out/qrcode_%s.png' % data)
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")
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