diff --git a/speckles.py b/speckles.py index b171c85..45f6f3e 100644 --- a/speckles.py +++ b/speckles.py @@ -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])