This commit is contained in:
Nikolaj
2022-01-14 10:40:45 +01:00
parent 0ef63ca80b
commit bcffb44393
10 changed files with 16 additions and 11 deletions

View File

@ -1,9 +1,8 @@
import os
import time
from PIL import Image, ImageFont, ImageDraw
import lorem
from font_game import base64, IMAGE_SIZE, IMAGE_BACKGROUND, MARGINS, FONT_COLOR
from font_game import gen_id, IMAGE_SIZE, IMAGE_BACKGROUND, MARGINS, FONT_COLOR
def gen_image(font: ImageFont.ImageFont) -> str:
img = Image.new("RGB", IMAGE_SIZE, IMAGE_BACKGROUND)
@ -29,7 +28,7 @@ def gen_image(font: ImageFont.ImageFont) -> str:
spacing=30
)
filename = base64(int(time.time() * 10000) % 0xffffff)
filename = gen_id()
path = f"static/images/{filename}.png"