Last active
August 29, 2015 14:01
-
-
Save cabreraalex/bf9d7d2da10ff6515abf to your computer and use it in GitHub Desktop.
Simple script which reads an image of white and black tiles and converts it into ASCII
This file contains hidden or 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
from PIL import Image | |
import binascii | |
i = Image.open("flag.png") | |
x = 0 | |
y = 0 | |
answer = "" | |
for x in range(0,361,20): | |
for y in range(0,361,20): | |
if i.getpixel((y,x))[0] == 0: | |
answer += "1" | |
else: | |
answer += "0" | |
for i in range(0, len(answer), 8): | |
print(chr(int(answer[i:i + 8], 2)), end='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment