{"id":940937,"date":"2024-12-26T21:16:11","date_gmt":"2024-12-26T13:16:11","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/940937.html"},"modified":"2024-12-26T21:16:14","modified_gmt":"2024-12-26T13:16:14","slug":"python%e5%a6%82%e4%bd%95%e6%b7%bb%e5%8a%a0svg","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/940937.html","title":{"rendered":"python\u5982\u4f55\u6dfb\u52a0svg"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25075339\/e376b731-3dff-4af4-9355-60833882892b.webp\" alt=\"python\u5982\u4f55\u6dfb\u52a0svg\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u6dfb\u52a0SVG\u7684\u65b9\u5f0f\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528\u5e93\u5982<code>svgwrite<\/code>\u3001<code>c<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>rosvg<\/code>\u3001<code>svgpathtools<\/code>\u7b49\u3002\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u4e0d\u540c\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u521b\u5efa\u3001\u7f16\u8f91\u548c\u6e32\u67d3SVG\u6587\u4ef6\u3002<code>svgwrite<\/code>\u53ef\u4ee5\u7528\u4e8e\u521b\u5efa\u65b0\u7684SVG\u6587\u4ef6\u3001<code>cairosvg<\/code>\u53ef\u4ee5\u5c06SVG\u8f6c\u6362\u4e3a\u5176\u4ed6\u683c\u5f0f\u3001<code>svgpathtools<\/code>\u5219\u662f\u7528\u4e8e\u64cd\u4f5cSVG\u8def\u5f84\u6570\u636e\u7684\u5de5\u5177\u3002<\/strong>\u5176\u4e2d\uff0c<code>svgwrite<\/code>\u662f\u4e00\u4e2a\u975e\u5e38\u7075\u6d3b\u4e14\u6613\u4e8e\u4f7f\u7528\u7684\u5e93\uff0c\u53ef\u4ee5\u8be6\u7ec6\u5730\u63a7\u5236SVG\u7684\u5404\u4e2a\u5143\u7d20\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528SVGWRITE\u521b\u5efaSVG\u6587\u4ef6<\/p>\n<\/p>\n<p><p><code>svgwrite<\/code>\u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684Python\u5e93\uff0c\u7528\u4e8e\u521b\u5efaSVG\u6587\u4ef6\u3002\u5b83\u63d0\u4f9b\u4e86\u8bb8\u591a\u529f\u80fd\u6765\u751f\u6210\u548c\u64cd\u4f5cSVG\u56fe\u5f62\u3002\u8981\u4f7f\u7528<code>svgwrite<\/code>\uff0c\u9996\u5148\u9700\u8981\u5b89\u88c5\u8fd9\u4e2a\u5e93\uff0c\u53ef\u4ee5\u901a\u8fc7pip\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install svgwrite<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol>\n<li>\n<p><strong>\u521b\u5efa\u57fa\u672cSVG\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>svgwrite<\/code>\u53ef\u4ee5\u8f7b\u677e\u521b\u5efaSVG\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u6f14\u793a\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u5706\u5f62\u548c\u77e9\u5f62\u7684SVG\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import svgwrite<\/p>\n<p>def create_svg(filename):<\/p>\n<p>    # \u521b\u5efa\u4e00\u4e2aSVGDrawing\u5bf9\u8c61<\/p>\n<p>    dwg = svgwrite.Drawing(filename, profile=&#39;tiny&#39;)<\/p>\n<p>    # \u6dfb\u52a0\u5706\u5f62<\/p>\n<p>    dwg.add(dwg.circle(center=(100, 100), r=50, fill=&#39;red&#39;))<\/p>\n<p>    # \u6dfb\u52a0\u77e9\u5f62<\/p>\n<p>    dwg.add(dwg.rect(insert=(200, 200), size=(100, 50), fill=&#39;blue&#39;))<\/p>\n<p>    # \u4fdd\u5b58\u6587\u4ef6<\/p>\n<p>    dwg.save()<\/p>\n<p>create_svg(&#39;example.svg&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u5305\u542b\u4e00\u4e2a\u7ea2\u8272\u5706\u5f62\u548c\u4e00\u4e2a\u84dd\u8272\u77e9\u5f62\u7684SVG\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6dfb\u52a0\u6587\u672c\u548c\u6837\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u9664\u4e86\u57fa\u672c\u7684\u5f62\u72b6\uff0c<code>svgwrite<\/code>\u8fd8\u5141\u8bb8\u6dfb\u52a0\u6587\u672c\u548c\u5e94\u7528\u6837\u5f0f\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import svgwrite<\/p>\n<p>def create_svg_with_text(filename):<\/p>\n<p>    dwg = svgwrite.Drawing(filename, profile=&#39;tiny&#39;)<\/p>\n<p>    # \u6dfb\u52a0\u6587\u672c<\/p>\n<p>    dwg.add(dwg.text(&quot;Hello SVG&quot;, insert=(150, 150), fill=&#39;black&#39;, font_size=20))<\/p>\n<p>    # \u6dfb\u52a0\u5e26\u6709\u6837\u5f0f\u7684\u5706<\/p>\n<p>    dwg.add(dwg.circle(center=(100, 100), r=50, fill=&#39;green&#39;, stroke=&#39;black&#39;, stroke_width=2))<\/p>\n<p>    dwg.save()<\/p>\n<p>create_svg_with_text(&#39;text_example.svg&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5728SVG\u4e2d\u6dfb\u52a0\u4e86\u6587\u672c&quot;Hello SVG&quot;\uff0c\u5e76\u4e14\u4e3a\u5706\u5f62\u5e94\u7528\u4e86\u7eff\u8272\u586b\u5145\u548c\u9ed1\u8272\u8fb9\u6846\u6837\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528CAIROSvg\u5c06SVG\u8f6c\u6362\u4e3a\u5176\u4ed6\u683c\u5f0f<\/p>\n<\/p>\n<p><p><code>cairosvg<\/code>\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06SVG\u6587\u4ef6\u8f6c\u6362\u4e3aPNG\u3001PDF\u7b49\u683c\u5f0f\u3002\u5b83\u4f7f\u7528\u8d77\u6765\u975e\u5e38\u7b80\u5355\u4e14\u9ad8\u6548\u3002\u9996\u5148\u9700\u8981\u5b89\u88c5\u8fd9\u4e2a\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install cairosvg<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5c06SVG\u8f6c\u6362\u4e3aPNG<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>cairosvg<\/code>\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06SVG\u6587\u4ef6\u8f6c\u6362\u4e3aPNG\u683c\u5f0f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cairosvg<\/p>\n<p>def convert_svg_to_png(svg_filename, png_filename):<\/p>\n<p>    cairosvg.svg2png(url=svg_filename, write_to=png_filename)<\/p>\n<p>convert_svg_to_png(&#39;example.svg&#39;, &#39;example.png&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u51fd\u6570\u63a5\u6536SVG\u6587\u4ef6\u8def\u5f84\u548c\u8f93\u51faPNG\u6587\u4ef6\u8def\u5f84\uff0c\u5c06SVG\u6587\u4ef6\u8f6c\u6362\u4e3aPNG\u683c\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5c06SVG\u8f6c\u6362\u4e3aPDF<\/strong><\/p>\n<\/p>\n<p><p>\u7c7b\u4f3c\u5730\uff0c\u53ef\u4ee5\u5c06SVG\u6587\u4ef6\u8f6c\u6362\u4e3aPDF\u683c\u5f0f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cairosvg<\/p>\n<p>def convert_svg_to_pdf(svg_filename, pdf_filename):<\/p>\n<p>    cairosvg.svg2pdf(url=svg_filename, write_to=pdf_filename)<\/p>\n<p>convert_svg_to_pdf(&#39;example.svg&#39;, &#39;example.pdf&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u51fd\u6570\u5c06SVG\u6587\u4ef6\u8f6c\u6362\u4e3aPDF\u683c\u5f0f\uff0c\u975e\u5e38\u9002\u5408\u9700\u8981\u6253\u5370\u7684\u573a\u5408\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528SVGPATHTOOLS\u64cd\u4f5cSVG\u8def\u5f84<\/p>\n<\/p>\n<p><p><code>svgpathtools<\/code>\u662f\u4e00\u4e2a\u4e13\u6ce8\u4e8eSVG\u8def\u5f84\u6570\u636e\u64cd\u4f5c\u7684\u5e93\u3002\u5b83\u63d0\u4f9b\u4e86\u8bb8\u591a\u6709\u7528\u7684\u529f\u80fd\u6765\u5904\u7406SVG\u8def\u5f84\u3002\u5b89\u88c5\u8fd9\u4e2a\u5e93\u4e5f\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install svgpathtools<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bfb\u53d6\u548c\u64cd\u4f5cSVG\u8def\u5f84<\/strong><\/p>\n<\/p>\n<p><p><code>svgpathtools<\/code>\u5141\u8bb8\u4f60\u8bfb\u53d6SVG\u6587\u4ef6\u4e2d\u7684\u8def\u5f84\uff0c\u5e76\u8fdb\u884c\u5404\u79cd\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from svgpathtools import svg2paths, wsvg<\/p>\n<p>def manipulate_svg_paths(svg_filename, output_filename):<\/p>\n<p>    # \u8bfb\u53d6SVG\u4e2d\u7684\u8def\u5f84<\/p>\n<p>    paths, attributes = svg2paths(svg_filename)<\/p>\n<p>    # \u8fdb\u884c\u4e00\u4e9b\u64cd\u4f5c\uff0c\u4f8b\u5982\u79fb\u52a8\u8def\u5f84<\/p>\n<p>    for path in paths:<\/p>\n<p>        path.translate(10, 10)<\/p>\n<p>    # \u4fdd\u5b58\u4fee\u6539\u540e\u7684\u8def\u5f84\u5230\u65b0\u7684SVG<\/p>\n<p>    wsvg(paths, filename=output_filename)<\/p>\n<p>manipulate_svg_paths(&#39;example.svg&#39;, &#39;modified_example.svg&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u8bfb\u53d6\u4e86SVG\u6587\u4ef6\u4e2d\u7684\u8def\u5f84\uff0c\u5e76\u5c06\u5176\u5411\u53f3\u4e0b\u65b9\u79fb\u52a8\u4e8610\u4e2a\u5355\u4f4d\uff0c\u7136\u540e\u4fdd\u5b58\u4e3a\u65b0\u7684SVG\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8def\u5f84\u6570\u636e\u7684\u590d\u6742\u64cd\u4f5c<\/strong><\/p>\n<\/p>\n<p><p><code>svgpathtools<\/code>\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u590d\u6742\u7684\u8def\u5f84\u64cd\u4f5c\uff0c\u5982\u8def\u5f84\u5408\u5e76\u3001\u8def\u5f84\u5206\u5272\u7b49\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from svgpathtools import Path, Line<\/p>\n<p>def create_complex_path():<\/p>\n<p>    # \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u8def\u5f84<\/p>\n<p>    path = Path(Line(start=(0, 0), end=(100, 100)),<\/p>\n<p>                Line(start=(100, 100), end=(200, 0)))<\/p>\n<p>    # \u8fdb\u884c\u4e00\u4e9b\u590d\u6742\u64cd\u4f5c\uff0c\u4f8b\u5982\u53cd\u8f6c\u8def\u5f84<\/p>\n<p>    reversed_path = path.reversed()<\/p>\n<p>    # \u6253\u5370\u8def\u5f84\u6570\u636e<\/p>\n<p>    print(reversed_path)<\/p>\n<p>create_complex_path()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u8def\u5f84\uff0c\u5e76\u8fdb\u884c\u4e86\u53cd\u8f6c\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u4f7f\u7528\u5176\u4ed6\u5e93\u4e0e\u5de5\u5177<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u4e0a\u8ff0\u5e93\uff0c\u8fd8\u6709\u5176\u4ed6\u4e00\u4e9bPython\u5e93\u548c\u5de5\u5177\u53ef\u4ee5\u7528\u4e8e\u5904\u7406SVG\uff0c\u4f8b\u5982<code>svglib<\/code>\u3001<code>reportlab<\/code>\u7b49\u3002\u8fd9\u4e9b\u5de5\u5177\u63d0\u4f9b\u4e86\u4e0d\u540c\u7684\u529f\u80fd\u548c\u7279\u6027\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>SVGLIB\u4e0eREPORTLAB<\/strong><\/p>\n<\/p>\n<p><p><code>svglib<\/code>\u53ef\u4ee5\u5c06SVG\u6587\u4ef6\u8f6c\u6362\u4e3a<code>reportlab<\/code>\u53ef\u8bc6\u522b\u7684\u683c\u5f0f\uff0c\u4ece\u800c\u7528\u4e8e\u751f\u6210PDF\u3002\u5b89\u88c5\u5b83\u4eec\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install svglib reportlab<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from svglib.svglib import svg2rlg<\/p>\n<p>from reportlab.graphics import renderPDF<\/p>\n<p>def svg_to_pdf_with_svglib(svg_filename, pdf_filename):<\/p>\n<p>    drawing = svg2rlg(svg_filename)<\/p>\n<p>    renderPDF.drawToFile(drawing, pdf_filename)<\/p>\n<p>svg_to_pdf_with_svglib(&#39;example.svg&#39;, &#39;example_reportlab.pdf&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u5c06SVG\u6587\u4ef6\u8f6c\u6362\u4e3aPDF\uff0c\u5229\u7528<code>svglib<\/code>\u548c<code>reportlab<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u751f\u6210\u52a8\u6001SVG<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u6839\u636e\u52a8\u6001\u6570\u636e\u751f\u6210SVG\u56fe\u5f62\u3002\u53ef\u4ee5\u7ed3\u5408Python\u7684\u5176\u4ed6\u6570\u636e\u5904\u7406\u5e93\uff08\u5982<code>pandas<\/code>\u3001<code>matplotlib<\/code>\uff09\u6765\u751f\u6210\u52a8\u6001SVG\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import pandas as pd<\/p>\n<p>def generate_dynamic_svg(data):<\/p>\n<p>    df = pd.DataFrame(data)<\/p>\n<p>    plt.plot(df[&#39;x&#39;], df[&#39;y&#39;])<\/p>\n<p>    plt.savefig(&#39;dynamic_example.svg&#39;, format=&#39;svg&#39;)<\/p>\n<p>data = {&#39;x&#39;: [0, 1, 2, 3, 4], &#39;y&#39;: [0, 1, 4, 9, 16]}<\/p>\n<p>generate_dynamic_svg(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>matplotlib<\/code>\u751f\u6210\u4e86\u4e00\u5f20\u7b80\u5355\u7684\u6298\u7ebf\u56fe\uff0c\u5e76\u4fdd\u5b58\u4e3aSVG\u683c\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u603b\u7ed3\u6765\u8bf4\uff0cPython\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5de5\u5177\u548c\u5e93\u6765\u5904\u7406SVG\u6587\u4ef6\uff0c\u4ece\u521b\u5efa\u3001\u7f16\u8f91\u5230\u8f6c\u6362\uff0c\u51e0\u4e4e\u6db5\u76d6\u4e86\u6240\u6709\u53ef\u80fd\u7684\u9700\u6c42\u3002\u9009\u62e9\u5408\u9002\u7684\u5e93\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u548c\u9700\u6c42\uff0c\u7075\u6d3b\u5730\u7ec4\u5408\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u53ef\u4ee5\u5b9e\u73b0\u975e\u5e38\u5f3a\u5927\u7684SVG\u5904\u7406\u529f\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u9879\u76ee\u4e2d\u4f7f\u7528SVG\u56fe\u50cf\uff1f<\/strong><br \/>\u5728Python\u9879\u76ee\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u5e93\u6765\u5904\u7406\u548c\u5c55\u793aSVG\u56fe\u50cf\u3002\u5e38\u7528\u7684\u5e93\u5305\u62ec<code>svgwrite<\/code>\u7528\u4e8e\u521b\u5efaSVG\u6587\u4ef6\uff0c<code>cairosvg<\/code>\u7528\u4e8e\u5c06SVG\u8f6c\u6362\u4e3a\u5176\u4ed6\u683c\u5f0f\uff0c\u6216\u8005\u4f7f\u7528<code>matplotlib<\/code>\u7b49\u5e93\u76f4\u63a5\u6e32\u67d3SVG\u6587\u4ef6\u3002\u5177\u4f53\u5b9e\u73b0\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5e93\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u5904\u7406SVG\u6587\u4ef6\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u4e8b\u9879\uff1f<\/strong><br \/>\u5904\u7406SVG\u6587\u4ef6\u65f6\uff0c\u6ce8\u610f\u786e\u4fddSVG\u6587\u4ef6\u7684\u683c\u5f0f\u6b63\u786e\uff0c\u907f\u514d\u4f7f\u7528\u4e0d\u517c\u5bb9\u7684\u7279\u6027\u3002\u540c\u65f6\uff0c\u4e86\u89e3\u4e0d\u540c\u5e93\u7684\u652f\u6301\u7a0b\u5ea6\uff0c\u5982<code>cairosvg<\/code>\u53ef\u80fd\u5bf9\u67d0\u4e9bSVG\u7279\u6027\u652f\u6301\u6709\u9650\uff0c\u5efa\u8bae\u6d4b\u8bd5\u8f6c\u6362\u540e\u7684\u6548\u679c\u3002\u6b64\u5916\uff0cSVG\u7684\u590d\u6742\u6027\u4e5f\u4f1a\u5f71\u54cd\u6e32\u67d3\u6027\u80fd\uff0c\u5c3d\u91cf\u7b80\u5316\u4e0d\u5fc5\u8981\u7684\u56fe\u5f62\u5143\u7d20\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Web\u5e94\u7528\u4e2d\u52a8\u6001\u751f\u6210SVG\uff1f<\/strong><br \/>\u5728Web\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u7684<code>Flask<\/code>\u6216<code>Django<\/code>\u7b49\u6846\u67b6\u7ed3\u5408<code>svgwrite<\/code>\u6765\u52a8\u6001\u751f\u6210SVG\u6587\u4ef6\u3002\u901a\u8fc7\u54cd\u5e94\u8bf7\u6c42\u751f\u6210SVG\u5e76\u8fd4\u56de\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5b9e\u65f6\u66f4\u65b0\u56fe\u50cf\u7684\u6548\u679c\u3002\u786e\u4fdd\u8bbe\u7f6e\u9002\u5f53\u7684HTTP\u5934\uff0c\u4ee5\u4fbf\u6d4f\u89c8\u5668\u80fd\u591f\u6b63\u786e\u8bc6\u522b\u5e76\u6e32\u67d3SVG\u5185\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u6dfb\u52a0SVG\u7684\u65b9\u5f0f\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528\u5e93\u5982svgwrite\u3001cAIrosvg\u3001svgpathtool [&hellip;]","protected":false},"author":3,"featured_media":940941,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/940937"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=940937"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/940937\/revisions"}],"predecessor-version":[{"id":940942,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/940937\/revisions\/940942"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/940941"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=940937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=940937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=940937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}