Print times instead of progress

This commit is contained in:
Peter J. Holzer 2024-05-03 23:50:23 +02:00 committed by Peter J. Holzer
parent b2d643955f
commit 0ba2bc05ce
1 changed files with 10 additions and 2 deletions

View File

@ -1,8 +1,13 @@
#!/usr/bin/python3
import time
t0 = time.clock_gettime(time.CLOCK_MONOTONIC)
from PIL import Image
im = Image.open("bodensee-m3.png")
print(im.format, im.size, im.mode)
print(time.clock_gettime(time.CLOCK_MONOTONIC) - t0)
#print(im.format, im.size, im.mode)
region_colors = {
( 0, 0, 255, 255),
( 0, 255, 255, 255),
@ -16,8 +21,9 @@ for y in range(0, im.size[1]):
p = im.getpixel((x, y))
if p in region_colors:
seeds[p].append((x, y))
print(time.clock_gettime(time.CLOCK_MONOTONIC) - t0)
for y in range(0, im.size[1]):
print(f"{y}")
#print(f"{y}")
for x in range(0, im.size[0]):
p = im.getpixel((x, y))
if p[3] == 0:
@ -34,4 +40,6 @@ for y in range(0, im.size[1]):
best_color = (*best_color[:3], 127)
im.putpixel((x, y), best_color)
print(time.clock_gettime(time.CLOCK_MONOTONIC) - t0)
im.save("bodensee-r3.png")
print(time.clock_gettime(time.CLOCK_MONOTONIC) - t0)