From d292f2b9b4eda5d91aad5352df8b5e6db10bfe7c Mon Sep 17 00:00:00 2001 From: Window-Hero <38403749+Window-Hero@users.noreply.github.com> Date: Sun, 15 Sep 2024 04:31:56 -0400 Subject: [PATCH] Update pil util font height (#123512) * Update pil.py The default font size is far too small and will frequently be rendered completely unreadable by JPEG compression. This is much more consistently readable, and properly specifies the font size in the draw.text function rather than relying on it being 8. * Update pil.py Converted to ruff format * Update pil.py Trying to get ruff formatting * Update pil.py fixed whitespace * Update pil.py removed trailing space --- homeassistant/util/pil.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/util/pil.py b/homeassistant/util/pil.py index 733f640ce48..6925cd03a4c 100644 --- a/homeassistant/util/pil.py +++ b/homeassistant/util/pil.py @@ -28,7 +28,7 @@ def draw_box( """ line_width = 3 - font_height = 8 + font_height = 20 y_min, x_min, y_max, x_max = box (left, right, top, bottom) = ( x_min * img_width, @@ -43,5 +43,8 @@ def draw_box( ) if text: draw.text( - (left + line_width, abs(top - line_width - font_height)), text, fill=color + (left + line_width, abs(top - line_width - font_height)), + text, + fill=color, + font_size=font_height, )