style: fix whitespace formatting and trailing newlines across multiple Python files

This commit is contained in:
2024-11-23 19:17:01 +00:00
parent 8b259cc39c
commit 9b195fcb48
6 changed files with 85 additions and 60 deletions
+16 -12
View File
@@ -1,9 +1,9 @@
from PIL import Image
from pathlib import Path
import functools
import sys
from pathlib import Path
import functools
import sys
printr = functools.partial(print,file=sys.stderr)
printr = functools.partial(print, file=sys.stderr)
per_image_width = 480
per_image_height = 320
@@ -11,19 +11,23 @@ cols = 2
images = list(Path("./export/").glob("*.png"))
image_count = len(images)
total_image_height = (image_count / cols * per_image_height)
if(image_count / cols * per_image_height > total_image_height):
total_image_height = image_count / cols * per_image_height
if image_count / cols * per_image_height > total_image_height:
total_image_height += per_image_height
total_image_width = image_count / cols * per_image_width
total_image_width = image_count / cols * per_image_width
resized_images = []
for path in images:
image = Image.open(path)
image = image.resize((per_image_width, per_image_height))
resized_images.append((path,image))
resized_images.append((path, image))
new_image = Image.new("RGB",(per_image_width * cols, int(per_image_height * image_count / cols)), (250,250,250))
new_image = Image.new(
"RGB",
(per_image_width * cols, int(per_image_height * image_count / cols)),
(250, 250, 250),
)
current_col = 0
current_row = 0
@@ -32,8 +36,8 @@ for path, image in resized_images:
printr("Merging image {}".format(path))
current_row = int(current_image_number / cols)
left = int((current_col) * per_image_width)
top = int(per_image_height * current_row )
new_image.paste(image,(left,top))
top = int(per_image_height * current_row)
new_image.paste(image, (left, top))
new_image.save("export/1_graphs_compliation.png")
current_col += 1
@@ -41,4 +45,4 @@ for path, image in resized_images:
if current_col == cols:
current_col = 0
new_image.show()
new_image.show()