mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-12-24 13:33:00 +00:00
random buchstaben position
This commit is contained in:
parent
444c16b0b4
commit
19336c542c
1 changed files with 4 additions and 1 deletions
|
@ -138,6 +138,7 @@ async def get_average_color(
|
|||
response_class=StreamingResponse,
|
||||
)
|
||||
async def get_picture_for_day(
|
||||
index: int,
|
||||
letter: str = Depends(get_letter),
|
||||
img: Image.Image = Depends(load_picture_standard),
|
||||
) -> StreamingResponse:
|
||||
|
@ -149,7 +150,8 @@ async def get_picture_for_day(
|
|||
font = ImageFont.truetype("Lena.ttf", 50)
|
||||
|
||||
# Position des Buchstaben bestimmen
|
||||
xy = (100, 150)
|
||||
rnd = random.Random(f"{loesungswort}{index}")
|
||||
xy = tuple(rnd.choices(range(30, 370), k=2))
|
||||
|
||||
# betroffenen Bildbereich bestimmen
|
||||
text_box = await get_text_box(
|
||||
|
@ -168,6 +170,7 @@ async def get_picture_for_day(
|
|||
|
||||
# etwas heller/dunkler machen
|
||||
tc_h, tc_s, tc_v = colorsys.rgb_to_hsv(*text_color)
|
||||
tc_v = int((tc_v - 127) * 0.97) + 127
|
||||
|
||||
if tc_v < 127:
|
||||
tc_v += 3
|
||||
|
|
Loading…
Reference in a new issue