From da7429ad6243e5c2f6aa241f030393a5879cab2f Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Sun, 11 Jun 2023 09:51:53 +0800 Subject: [PATCH] perf: add markdown minheight --- util/general_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/general_utils.py b/util/general_utils.py index 9af094a2e..ec74545b2 100644 --- a/util/general_utils.py +++ b/util/general_utils.py @@ -141,7 +141,7 @@ def word2img(title: str, text: str, max_width=30, font_size=20): def render_markdown(markdown_text, image_width=800, image_height=600, font_size=16, font_color=(0, 0, 0), bg_color=(255, 255, 255)): - + if os.path.exists("resources/fonts/syst.otf"): font_path = "resources/fonts/syst.otf" elif os.path.exists("QQChannelChatGPT/resources/fonts/syst.otf"): @@ -232,6 +232,8 @@ def render_markdown(markdown_text, image_width=800, image_height=600, font_size= markdown_text = '\n'.join(pre_lines) print("Pre process done, height: ", height) image_height = height + if image_height < 100: + image_height = 100 image_width += 10 # 创建空白图像