From 45f6b6fadf063b89d25ec9befbd8d1f52dc648bb Mon Sep 17 00:00:00 2001 From: link2xt Date: Wed, 6 Sep 2023 22:36:57 +0000 Subject: [PATCH] fix: adapt the code for Pillow 10.0.0 See issue --- src/mailadm/gen_qr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mailadm/gen_qr.py b/src/mailadm/gen_qr.py index 182b2ae0..c0e07925 100644 --- a/src/mailadm/gen_qr.py +++ b/src/mailadm/gen_qr.py @@ -54,7 +54,9 @@ def gen_qr(config, token_info): qr_final_size = width - (qr_padding * 2) # draw text - info_pos = (width - font.getsize(info.strip())[0]) // 2 + font_left, _font_top, font_right, _font_bottom = font.getbbox(info.strip()) + font_width = font_right - font_left + info_pos = (width - font_width) // 2 draw.multiline_text( (info_pos, size - qr_padding // 2), info,