def account_by_qr(qr_file):
qr = qrtools.QR()
qr.decode(qr_file)
# Try to increase contrast if not recognized
if ('xrb_' not in qr.data):
image = Image.open(qr_file)
contrast = ImageEnhance.Contrast(image)
image = contrast.enhance(7)
image.save('{0}'.format(qr_file.replace('.jpg', '_.jpg')), 'JPEG')
qr2 = qrtools.QR()
qr2.decode('{0}'.format(qr_file.replace('.jpg', '_.jpg')))
#print(qr2.data)
qr = qr2
returning = qr.data.replace('xrb:', '').replace('raiblocks://', '').replace('raiblocks:', '').split('?')
# parsing amount
if (len(returning) > 1):
if ('amount=' in returning[1]):
returning[1] = returning[1].replace('amount=', '')
# don't use empty
if (len(returning[1]) == 0):
returning.pop()
else:
returning.pop()
return returning
评论列表
文章目录