如何绘制SVG箭头,ImageMagick可以将其导出到PNG

时间:2012-05-04 07:47:20

标签: svg png imagemagick inkscape

这是我的SVG文件:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="32px"
   height="32px"
   id="svg2985"
   version="1.1"
   inkscape:version="0.48.3.1 r9886"
   sodipodi:docname="changeStatus.png">
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="11.197802"
     inkscape:cx="-0.20853807"
     inkscape:cy="16"
     inkscape:current-layer="layer1"
     showgrid="true"
     inkscape:grid-bbox="true"
     inkscape:document-units="px"
     inkscape:window-width="1330"
     inkscape:window-height="780"
     inkscape:window-x="2493"
     inkscape:window-y="54"
     inkscape:window-maximized="0" />
  <defs
     id="defs2987">
    <marker
       style="overflow:visible;"
       id="Arrow2Mend5"
       refX="0.0"
       refY="0.0"
       orient="auto"
       inkscape:stockid="Arrow2Mend5">
      <path
         transform="scale(0.6) rotate(180) translate(0,0)"
         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
         style="stroke-linejoin:round;stroke:#9999cc;stroke-width:0.62500000;fill:#9999cc;fill-rule:evenodd"
         id="path4232" />
    </marker>
  </defs>
  <metadata
     id="metadata2990">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:groupmode="layer"
     inkscape:label="Layer 1"
     id="layer1">
    <rect
       ry="0"
       y="2.1727178"
       x="2.2176549"
       height="7.412169"
       width="28.003029"
       id="rect2993"
       style="fill:none;stroke:#9999cc;stroke-width:2;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
    <rect
       ry="0"
       y="22.221294"
       x="2.3409784"
       height="7.412169"
       width="28.003029"
       id="rect2993-1"
       style="fill:none;stroke:#9999cc;stroke-width:2;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" />
    <path
       inkscape:connector-curvature="0"
       id="path3781"
       d="m 15.98528,6.5033682 0,16.5092328"
       style="fill:none;stroke:#9999cc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:2;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mend5)" />
  </g>
</svg>

现在当我用Incscape作为PNG保存时,一切运行良好:

ChangeStatus Incscape

但是当我使用ImageMagick转换它时箭头丢失了:

ChangeStatus ImageMagick

我将其转换为:

convert -resize 32x32 -transparent white changeStatus.svg changeStatus.png

我需要在SVG源中修改ImageMagic才能处理它?<​​/ p>

1 个答案:

答案 0 :(得分:2)

您可以将箭头转换为Inkscape中的路径。选择箭头,然后使用行程到行程(可以通过“路径 - >行程到路径”或通过快捷键Ctrl-Alt-C访问)。

如果将修改后的数字保存为svg,则通过ImageMagic进行转换应该没问题。