def save_qrcode(qr, filename):
    k = qr.moduleCount
    bitmap = BitMap( (k+2)*8, (k+2)*8 )
    bitmap.bitarray = []
    for r in range(k+2):
        tmparray = [ 0 ] * (k+2)*8

        if 0 < r < k+1:
            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 )
dataset/ETHPy150Open bitxbay/BitXBay/electru/build/lib/electrum/bmp.py/save_qrcode/original