|
|
|
@ -53,7 +53,8 @@ def trim_image(image_path):
@@ -53,7 +53,8 @@ def trim_image(image_path):
|
|
|
|
|
background = PIL.Image.new(original.mode, original.size, original.getpixel((0, 0))) |
|
|
|
|
diff = PIL.ImageChops.difference(original, background) |
|
|
|
|
diff = PIL.ImageChops.add(diff, diff, 2.0, -100) |
|
|
|
|
bbox = diff.getbbox() |
|
|
|
|
left, upper, right, lower = diff.getbbox() |
|
|
|
|
bbox = (left - 10, upper - 10, right + 12, lower + 10) |
|
|
|
|
cropped = original.crop(bbox) if bbox else original |
|
|
|
|
buffer = io.BytesIO() |
|
|
|
|
cropped.save(buffer, format="png") |
|
|
|
@ -126,14 +127,17 @@ def print_info_flowable(print_info):
@@ -126,14 +127,17 @@ def print_info_flowable(print_info):
|
|
|
|
|
f"{print_info['humidity']} (humidifier might be turned off)", |
|
|
|
|
), |
|
|
|
|
] |
|
|
|
|
return Table(data, style=[ |
|
|
|
|
('TOPPADDING', (0, 0), (-1, -1), 0), |
|
|
|
|
('RIGHTPADDING', (0, 0), (-1, -1), 7), |
|
|
|
|
('BOTTOMPADDING', (0, 0), (-1, -1), 0), |
|
|
|
|
('LEFTPADDING', (0, 0), (-1, -1), 0), |
|
|
|
|
('FONTSIZE', (0, 0), (-1, -1), 8), |
|
|
|
|
],hAlign='LEFT' |
|
|
|
|
) |
|
|
|
|
return Table( |
|
|
|
|
data, |
|
|
|
|
style=[ |
|
|
|
|
("TOPPADDING", (0, 0), (-1, -1), 0), |
|
|
|
|
("RIGHTPADDING", (0, 0), (-1, -1), 7), |
|
|
|
|
("BOTTOMPADDING", (0, 0), (-1, -1), 0), |
|
|
|
|
("LEFTPADDING", (0, 0), (-1, -1), 0), |
|
|
|
|
("FONTSIZE", (0, 0), (-1, -1), 8), |
|
|
|
|
], |
|
|
|
|
hAlign="LEFT", |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_report(log_files, drops, missing, environment, print_info): |
|
|
|
|