Initial release

This commit is contained in:
Francois JUMELLE
2021-05-03 22:32:40 +02:00
commit 20526d93c8
928 changed files with 452368 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
from PIL import Image
image = Image.open("stables.png")
width, height = image.size
def fill(x, y):
global image
global width
global height
image.putpixel((x,y), 127)
if x < width-1 and image.getpixel((x+1,y)) == 255:
fill(x+1, y)
if x > 0 and image.getpixel((x-1,y)) == 255:
fill(x-1, y)
if y < height-1 and image.getpixel((x,y+1)) == 255:
fill(x, y+1)
if y > 0 and image.getpixel((x,y-1)) == 255:
fill(x, y-1)
zones = 0
for x in range(width):
for y in range(height):
if image.getpixel((x,y)) == 255:
fill(x,y)
# image.show()
zones += 1
print(zones)
image.show()