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)
|
image.write_to_file(filename)
|
||||||
return filename
|
return filename
|
||||||
elif fileformat:
|
elif fileformat:
|
||||||
|
if fileformat == "svg":
|
||||||
buf = io.BytesIO(content.as_str().encode("utf-8"))
|
buf = io.BytesIO(content.as_str().encode("utf-8"))
|
||||||
buf.seek(0)
|
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])
|
return StreamingResponse(content=buf, media_type=MEDIA_TYPES[fileformat])
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user