From dfaef09ccbc27fd67181f8aa731745100bb858d5 Mon Sep 17 00:00:00 2001 From: julius Date: Mon, 21 Oct 2024 13:32:10 +0200 Subject: [PATCH] add filename option --- main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index b76615c..67d8aca 100644 --- a/main.py +++ b/main.py @@ -92,7 +92,7 @@ def make_wallpaper( size: float = 3, fileformat: str = "svg", orientation: str = "landscape", - local: bool = False, + filename: str = "", markers: str = ".", perlin: bool = True, ): @@ -163,14 +163,13 @@ def make_wallpaper( pad_inches=0, ) buf.seek(0) - if local: - filename = f"speckles.{fileformat}" + if filename: with open(filename, "wb") as f: f.write(buf.getbuffer()) + buf.close() return filename else: return StreamingResponse(content=buf, media_type=MEDIA_TYPES[fileformat]) - buf.close() if __name__ == "__main__":