Skip to content

Instantly share code, notes, and snippets.

@akrasuski1
Created March 18, 2018 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akrasuski1/1e3e04ed43a0972abae4a9d9988e6ffd to your computer and use it in GitHub Desktop.
Save akrasuski1/1e3e04ed43a0972abae4a9d9988e6ffd to your computer and use it in GitHub Desktop.
from PIL import Image
import sys
datas = []
for name in range(3):
im = Image.open("imgs/img-%d.png" % name)
data = im.getdata()
bits = []
for i in range(26):
for j in range(16):
bits.append(data[64*64*16*i+64*j]/255)
bytes = []
for i in range(26*2):
c = 0
for j in range(8):
c *= 2
c += bits[i*8+j]
bytes.append(c)
datas.append(bytes)
for d in datas:
print d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment