-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07.py
executable file
·31 lines (29 loc) · 877 Bytes
/
07.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
#title: smarty
#fact1: The PNG file has a weird grey area, so the information must be encoded there
import Image
im = Image.open("oxygen.png")
print "Image info:",im.format, im.size, im.mode
#we'll limit the grey zone
y_begin = 0
while True:
p = im.getpixel((0, y_begin))
if p[0] == p[1] == p[2]:
break
y_begin += 1
x_end = 0
while True:
p = im.getpixel((x_end, y_begin))
if not p[0] == p[1] == p[2]:
break
x_end += 1
print "Y first coordinate:", y_begin,"\nX last coordinate:",x_end
message=[]
for i in range(0,x_end,7):
p = im.getpixel((i, y_begin))
message.append(chr(p[0]))
print ''.join(message),
#smart guy, you made it. the next level is [105, 110, 116, 101, 103, 114, 105, 116, 121]
message=[105, 110, 116, 101, 103, 114, 105, 116, 121]
print '(',''.join([chr(x) for x in message]),')'
#integrity