-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathl14_wire.py
More file actions
52 lines (39 loc) · 766 Bytes
/
l14_wire.py
File metadata and controls
52 lines (39 loc) · 766 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import PIL
from PIL import Image
f = Image.open("C:\\wire.png")
l = list(f.getdata())
lnew = []
## 100 is special case
cnt = 0
lnew.extend(l[cnt:cnt+100])
cnt += 100
for i in range(99, 0, -1):
lnew.extend(l[cnt:cnt+i])
cnt += i
lnew.extend(l[cnt:cnt+i])
cnt += i
print i
print cnt
print len(lnew)
g = Image.new("RGB", (100,100))
g.putdata(lnew)
g.save("C:\\aha.png")
lnew = []
## 100 is special case
cnt = 10000-1
lnew.extend(l[cnt:cnt-100:-1])
cnt -= 100
for i in range(99, 1, -1):
lnew.extend(l[cnt:cnt-i:-1])
cnt -= i
lnew.extend(l[cnt:cnt-i:-1])
cnt -= i
## now 1 is special too
lnew.extend(l[cnt::-1])
cnt -= 1
print i
print cnt
print len(lnew)
g = Image.new("RGB", (100,100))
g.putdata(lnew)
g.save("C:\\aha2.png")