random picture
This commit is contained in:
parent
3c925726d3
commit
0c51199215
1 changed files with 11 additions and 4 deletions
|
@ -91,14 +91,21 @@ async def get_file(path: str) -> BytesIO:
|
||||||
return buffer
|
return buffer
|
||||||
|
|
||||||
|
|
||||||
async def load_picture_standard() -> Image.Image:
|
async def load_picture_standard(
|
||||||
|
index: int,
|
||||||
|
) -> Image.Image:
|
||||||
"""
|
"""
|
||||||
Bild laden und einen quadratischen Ausschnitt
|
Bild laden und einen quadratischen Ausschnitt
|
||||||
aus der Mitte nehmen
|
aus der Mitte nehmen
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
print(await list_images(""))
|
||||||
|
|
||||||
# Bild laden
|
# Bild laden
|
||||||
img_buffer = await get_file("lena2.jpg")
|
rnd = random.Random(f"{loesungswort}{index}")
|
||||||
|
dat = rnd.choice(await list_images(""))
|
||||||
|
|
||||||
|
img_buffer = await get_file(dat)
|
||||||
img = Image.open(img_buffer)
|
img = Image.open(img_buffer)
|
||||||
|
|
||||||
# Größen bestimmen
|
# Größen bestimmen
|
||||||
|
@ -114,7 +121,7 @@ async def load_picture_standard() -> Image.Image:
|
||||||
))
|
))
|
||||||
|
|
||||||
img = img.resize(
|
img = img.resize(
|
||||||
size=(400, 400),
|
size=(500, 500),
|
||||||
resample=Image.ANTIALIAS,
|
resample=Image.ANTIALIAS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -186,7 +193,7 @@ async def get_picture_for_day(
|
||||||
|
|
||||||
# Position des Buchstaben bestimmen
|
# Position des Buchstaben bestimmen
|
||||||
rnd = random.Random(f"{loesungswort}{index}")
|
rnd = random.Random(f"{loesungswort}{index}")
|
||||||
xy = tuple(rnd.choices(range(30, 370), k=2))
|
xy = tuple(rnd.choices(range(30, 470), k=2))
|
||||||
|
|
||||||
# betroffenen Bildbereich bestimmen
|
# betroffenen Bildbereich bestimmen
|
||||||
text_box = await get_text_box(
|
text_box = await get_text_box(
|
||||||
|
|
Loading…
Reference in a new issue