Fix QR code generation: omit format kwarg for pure PNG backend, add qrcode/pypng deps

This commit is contained in:
mltobi
2026-10-05 20:56:01 +02:00
parent 1b26e17542
commit 7b3e217328
2 changed files with 9 additions and 2 deletions
@@ -43,9 +43,10 @@ def generate_qr_code_png(data: str, size: int = 512) -> Optional[bytes]:
# Generate image using pure Python PNG backend
img = qr.make_image(image_factory=PyPNGImage, fill_color="black", back_color="white")
# Convert to PNG bytes
# Convert to PNG bytes. PyPNGImage.save() always writes PNG and does
# not accept a `format` kwarg (unlike PIL), so it must be omitted here.
buffer = io.BytesIO()
img.save(buffer, format="PNG")
img.save(buffer)
png_data = buffer.getvalue()
return png_data
+6
View File
@@ -17,6 +17,12 @@ requests~=2.32.5
Unidecode~=1.3.7
PyYAML~=6.0.3
# QR-code login (magenta2 SAM3 remote login). pypng provides qrcode's pure
# Python PNG backend so no Pillow/system image libs are required in the
# standalone/Docker runtime.
qrcode>=7.4
pypng>=0.0.21
# Optional but recommended
aiohttp>=3.8.5
cryptography>=41.0.4