1
0

more QR code capabilities: encode amount, save to file

This commit is contained in:
ThomasV
2012-05-01 17:06:14 +02:00
parent 50e5f910a7
commit 9050a41381
3 changed files with 110 additions and 36 deletions

16
bmp.py
View File

@@ -193,7 +193,23 @@ class BitMap(object):
f.close()
def save_qrcode(qr, filename):
bitmap = BitMap( 35*8, 35*8 )
#print len(bitmap.bitarray)
bitmap.bitarray = []
k = 33
for r in range(35):
tmparray = [ 0 ] * 35*8
if 0 < r < 34:
for c in range(k):
if qr.isDark(r-1, c):
tmparray[ (1+c)*8:(2+c)*8] = [1]*8
for i in range(8):
bitmap.bitarray.append( tmparray[:] )
bitmap.saveFile( filename )