well, sure, but maybe everything would work better if adam weren't such an idiot

main
adam j hartz 2023-05-24 00:02:32 -04:00
parent 8f47a041a4
commit 3abb62ee78
Signed by: hz
GPG Key ID: 5FDD2840E179AD62
1 changed files with 6 additions and 3 deletions

View File

@ -21,10 +21,13 @@ def parse(code):
def _qr_helper(im):
best = None
for scale in [1, 3 / 4, 2 / 3, 0.5, 1 / 3, 1 / 4]:
scaledim = (
im.resize((int(im.width * scale), int(im.height * scale)))
if scale != 1
else im
)
for sharpness in [1, 1.25, 0.75, 1.5, 0.5, 1.75, 0.25, 2, 0]:
newim = ImageEnhance.Sharpness(
im.resize((int(im.width * scale), int(im.height * scale)))
).enhance(sharpness)
newim = ImageEnhance.Sharpness(scaledim).enhance(sharpness)
qrinfo = pyzbar.decode(newim)
if len(qrinfo) == 2: