From 7dc11e6c3590d63a4a1a66ee3a8d7c9e25ec952b Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 24 Feb 2026 14:02:05 +0800 Subject: [PATCH] bugfix --- appPublic/qr.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 appPublic/qr.py diff --git a/appPublic/qr.py b/appPublic/qr.py new file mode 100644 index 0000000..dfc090a --- /dev/null +++ b/appPublic/qr.py @@ -0,0 +1,16 @@ +import qrcode + +def gen_qr(data, path): + qr = =qrcode.QRCode( + version=1, # 控制二维码大小(1~40) + error_correction=qrcode.constants.ERROR_CORRECT_L, # 容错率 L(7%)、M(15%)、Q(25%)、H(30%) + box_size=10, # 每个格子的像素大小 + border=4, # 边框宽度(最小为4) + ) + qr.add_data(data) + qr.make(fit=True) # 自动调整版本以适应数据 + + # 生成图像 + img = qr.make_image(fill_color="black", back_color="white") + img.save(path) +