enable other image formats API

This commit is contained in:
julius 2024-10-27 20:09:57 +01:00
parent beb81771a8
commit 94489b5da2
Signed by: julius
GPG Key ID: C80A63E6A5FD7092

View File

@ -293,8 +293,12 @@ def make_wallpaper(
image.write_to_file(filename)
return filename
elif fileformat:
buf = io.BytesIO(content.as_str().encode("utf-8"))
buf.seek(0)
if fileformat == "svg":
buf = io.BytesIO(content.as_str().encode("utf-8"))
buf.seek(0)
else:
with pyvips.Image.svgload_buffer(content.as_str().encode("utf-8")) as image:
buf = image.write_to_buffer(fileformat)
return StreamingResponse(content=buf, media_type=MEDIA_TYPES[fileformat])