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
This commit is contained in:
Window-Hero
2024-09-15 04:31:56 -04:00
committed by GitHub
parent 6dadd467ab
commit d292f2b9b4

View File

@ -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,
)