Closed sunwoo76 closed 1 month ago
Hello @sunwoo76,
I would write eg.:
#!/usr/bin/env python3
import pyvips
x = pyvips.Image.new_from_buffer(b"""
<svg viewBox="0 0 128 128">
<rect width="128" height="128" fill="#efe0b966" />
</svg>
""", "")
x.write_to_file("x.png")
Hello @sunwoo76,
I would write eg.:
#!/usr/bin/env python3 import pyvips x = pyvips.Image.new_from_buffer(b""" <svg viewBox="0 0 128 128"> <rect width="128" height="128" fill="#efe0b966" /> </svg> """, "") x.write_to_file("x.png")
Thank you for replying :)
However, when I save the some svg strings the following error has occurred:
image = pyvips.Image.new_from_buffer(svg_str)
TypeError: Image.new_from_buffer() missing 1 required positional argument: 'options'
Can this issue be occurred by the lower version of libvips or pyvips? Thanks:
You need the ""
final argument.
</svg>
""", "")
Hello :)
I have the following code as below:
When I convert svg string to png format, I always save svg string to svg file and load using pyvips library. Finally, save with PIL Image library.
How can I directly save the svg string to png image?
Thank you!