Last active
August 6, 2016 14:06
-
-
Save flipbug/d9d0b45e17b859e53f82 to your computer and use it in GitHub Desktop.
Draw qr code as bitmap from binary representation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rawData = "1111111000001001101111111100000101010011110100000110111010000010111010111011011101011101111001011101101110100100000010101110110000010110001110010000011111111010101010101111111000000000110001000000000011111011110001011101010101111100100111100000001010001110101010101111001000110001101000110111111010001011011011101010001010111111101010100010001010001110111110110010111111100111011000011101001001001001101110110100011111111110000000000100101001000101011111111010000010101010011100000100100000110001001110111010100111111111111101011101011111010011111011101110101010110100010000110000010101000011110100011111111011000100011101011" | |
header = b'\x42\x4D\x4C\x00\x00\x00\x00\x00\x00\x00\x1A\x00\x00\x00\x0C\x00\x00\x00' | |
dimension = b'\x19\x00\x19\x00\x01\x00\x18\x00' | |
white = b'\xFF\xFF\xFF' | |
black = b'\x00\x00\x00' | |
data = [] | |
for i, c in enumerate(rawData): | |
row = [] | |
if c is "1": | |
row.append(black) | |
else: | |
row.append(white) | |
if (i % 25) is 0 and (i != 0): | |
row[i] += b'\x00' | |
f = open('qr7_2.bmp', 'wb') | |
f.write(header) | |
f.write(dimension) | |
for d in data: | |
f.write(d) | |
f.write(b'\x00\x00') | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment