修改优化帮助图片生成逻辑

This commit is contained in:
HibiKier
2022-11-19 01:05:08 +08:00
parent 75b8cc0766
commit 49e38862af
4 changed files with 124 additions and 28 deletions
+3 -1
View File
@@ -2,11 +2,12 @@ import asyncio
import base64
import random
import re
import time
from io import BytesIO
from math import ceil
from pathlib import Path
from typing import List, Literal, Optional, Tuple, Union
import uuid
import cv2
import imagehash
from configs.path_config import FONT_PATH, IMAGE_PATH
@@ -180,6 +181,7 @@ class BuildImage:
self.paste_image_height = int(paste_image_height)
self._current_w = 0
self._current_h = 0
self.uid = uuid.uuid1()
self.font = ImageFont.truetype(str(FONT_PATH / font), int(font_size))
if not plain_text and not color:
color = (255, 255, 255)