-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel_12.py
38 lines (29 loc) · 956 Bytes
/
level_12.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
32
33
34
35
36
37
38
#!/bin/env python
# coding=utf-8
# http://huge:[email protected]/pc/return/evil.html
# Deal cards? Deal evils? 1,2,3,4,5.
from io import BytesIO
import requests
from PIL import Image
from PIL import ImageFile
PREFIX = "http://huge:[email protected]/pc/return/"
url = PREFIX + 'evil2.gfx'
def solve(something):
ImageFile.LOAD_TRUNCATED_IMAGES = True
background = Image.new('RGB', (640, 96))
cur_width = 0
for i in range(5):
piece = something[i::5]
im = Image.open(BytesIO(piece)).resize((640 // 5, 96))
background.paste(im, (cur_width, 0))
cur_width += im.size[0]
return background
def plot(im):
im.show()
if __name__ == "__main__":
r = requests.get(url)
something = r.content
answer = solve(something)
plot(answer)
# disproportional
# http://huge:[email protected]/pc/return/disproportional.html