-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7.py
More file actions
28 lines (23 loc) · 855 Bytes
/
7.py
File metadata and controls
28 lines (23 loc) · 855 Bytes
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
from PIL import Image, ImageFile
image_name = 'oxygen.png'
if __name__ == '__main__':
# img = open(image_name, 'rb')
# p = ImageFile.Parser()
#
# while 1:
# s = img.read(1024)
# if not s:
# break
# p.feed(s)
#
# new_img = p.close()
# new_img.save('copy' + image_name)
img = Image.open(image_name)
px = img.load()
print(px[img.width-1, img.height-1])
for r in range(img.height):
px_color = px[0, r]
if px_color[1] == px_color[0] and px_color[2] == px_color[0]:
print(''.join([''.join([chr(px[(c, r)][i]) for i in range(3)]) for c in range(img.width) ]))# if px[(c, r)][0] != px[(c, r)][1] and px[(c, r)][0] != px[(c, r)][2]])
break
print(''.join([chr(l) for l in [105, 110, 116, 101, 103, 114, 105, 116, 121]]))