Skip to content

Instantly share code, notes, and snippets.

@neptunia
Created May 22, 2016 17:15
Show Gist options
  • Save neptunia/e64274dfe9db3b5a935081d7cbc4d5fc to your computer and use it in GitHub Desktop.
Save neptunia/e64274dfe9db3b5a935081d7cbc4d5fc to your computer and use it in GitHub Desktop.
from PIL import Image
im = Image.open("solved.bmp")
width, height = im.size
print width
im = Image.open("superpng.png") # part 2
width, height = im.size
print width
buf = ''
out = ''
for pixel in im.getdata():
if len(buf) == 8:
print(buf)
out += hex(int(buf,2)).replace('0x','')
buf = ''
if pixel == (255,255,255):
buf += '0'
else:
buf += '1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment