我有svg数据,例如
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="500" height="500" xml:space="preserve">
<desc>Created with Fabric.js 1.4.0</desc>
<defs></defs>
<g transform="translate(250 250)">
<image xlink:href="http://arcanumdeepsecrets.files.wordpress.com/2010/06/blast_500x500.jpg" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(-250 -250)" width="500" height="500" preserveAspectRatio="none"></image>
</g>
<rect x="-250" y="-250" rx="0" ry="0" width="500" height="500" style="stroke: red; stroke-width: 1; stroke-dasharray: 5 5; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; opacity: 1;" transform="translate(250 250)"/>
<rect x="-245" y="-245" rx="0" ry="0" width="490" height="490" style="stroke: green; stroke-width: 1; stroke-dasharray: 5 5; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; opacity: 1;" transform="translate(250 250)"/>
<rect x="-240" y="-240" rx="0" ry="0" width="480" height="480" style="stroke: blue; stroke-width: 1; stroke-dasharray: 5 5; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; opacity: 1;" transform="translate(250 250)"/>
<polygon points="-25 25,0 -25,25 25" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: red; opacity: 1;" transform="translate(248 296)"/>
<g transform="translate(256.5 176.85)">
<text font-family="arial" font-size="29" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(-23.5 28)">
<tspan x="0" y="-18.85" fill="rgb(0,0,0)">wer</tspan>
</text>
</g>
<g transform="translate(269.04 238.43) scale(2.61 2.61)">
<text font-family="comic sans ms" font-size="29" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(-75 28)">
<tspan x="0" y="-18.85" fill="rgb(0,0,0)">Some Text</tspan>
</text>
</g>
</svg>
这是发给我的
我试图获取这些数据并将其保存为分辨率为300(保持质量)的JPG格式,并保留所使用的外部链接和字体。
有谁知道如何做到这一点。我迷路了,无法知道从哪里开始。我读过图像magick可能会这样做,但没有看到任何这方面的例子。