Skip to content

Commit 5210b8d

Browse files
try to solve 14
1 parent a60c97f commit 5210b8d

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

Diff for: 14-2.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
count = 0
1010
for x in range(width):
1111
for y in range(height):
12-
print(im.getpixel((x, y)))
12+
print(("x:{}, y:{}, : {}").format(x, y, im.getpixel((x, y))))
1313
count += 1
14-
print(count)
14+
print(count)

Diff for: 14.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from PIL import Image
2+
from PIL import ImageDraw
3+
4+
im = Image.open("wire/wire.png")
5+
result = Image.new("RGB", (100, 100), "white")
6+
drawer = ImageDraw.Draw(result)
7+
8+
im_size = im.size
9+
im_x = im_size[0]
10+
im_y = im_size[1]
11+
12+
result_size = result.size
13+
result_x = result_size[0]
14+
result_y = result_size[1]
15+
16+
count = 0
17+
for y in range(result_y):
18+
for x in range(result_x):
19+
# print("count is {}, im.getpixel((count,0)) is{}".format(count,im.getpixel((count, 0))))
20+
drawer.point((x, y), im.getpixel((count,0)))
21+
count += 1
22+
23+
result.show()
24+
result.save("wire/result.png")

Diff for: wire/italy.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<!-- remember: 100*100 = (100+99+99+98) + (... -->
1212

13-
<img src="wire.png" width="2000" height="5">
13+
<img src="wire.png" width="500" height="20">
1414

1515
</body>
1616
</html>

Diff for: wire/result.png

16.2 KB
Loading

0 commit comments

Comments
 (0)