enable other image formats API
This commit is contained in:
parent
beb81771a8
commit
94489b5da2
@ -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])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user