Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- from string import ascii_letters
- import ipdb
- i = Image.open("challenge.x.png")
- ret = filter(lambda x: x in ascii_letters+" .,", i.tobytes())
- lines = []
- for line in range(640):
- c = 0
- for col in range(640):
- pix = i.getpixel((line, col))
- if not pix == (0, 0, 0):
- c += 1
- preresult += ret.pop(0)
- if c:
- lines.append(c)
- result = ret[:36]
- offset = 36
- halfs = lines[1:-2]
- for half in halfs:
- result += ret[offset+half/2:offset+half]
- offset += half
- print result
Add Comment
Please, Sign In to add comment