Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions draw_card/build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from PIL import Image, ImageDraw, UnidentifiedImageError
from nonebot.log import logger
from typing import Tuple, Union
from typing import Tuple, Union, Optional, Literal
from .util import load_font
import asyncio

Expand All @@ -16,8 +16,21 @@ def __init__(
img_w: int = 0,
img_h: int = 0,
background: str = "",
color="white",
image_type="RGBA",
color: Union[float, Tuple[float, ...], str] = "white",
image_type: Literal[
"1",
"CMYK",
"F",
"HSV",
"I",
"L",
"LAB",
"P",
"RGB",
"RGBA",
"RGBX",
"YCbCr",
] = "RGBA",
divisor: float = 1,
font_size: int = 10,
):
Expand Down Expand Up @@ -99,7 +112,7 @@ def text(
async def apaste(
self,
img: "BuildImage" or Image,
pos: Tuple[int, int] = None,
pos: Optional[Tuple[int, int]] = None,
alpha: bool = False,
):
"""
Expand Down
Loading