小功能&一些东西的实现
jpg 转 base64 svg
import base64
def png_to_svg(png_file):
with open(png_file, "rb") as f:
data = f.read()
base64_encoded = base64.b64encode(data).decode("utf-8")
svg_content = f"""<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<image xlink:href="data:image/png;base64,{base64_encoded}"/>
</svg>"""
svg_file = png_file.replace(".png", ".svg")
with open(svg_file, "w") as f:
f.write(svg_content)
png_to_svg("")
Comments NOTHING