From 0ba2bc05ce46380f07991565f5759d3a0e2ad990 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 3 May 2024 23:50:23 +0200 Subject: [PATCH] Print times instead of progress --- bodensee-borders | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bodensee-borders b/bodensee-borders index aec7d39..d1632fa 100755 --- a/bodensee-borders +++ b/bodensee-borders @@ -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)