Imagemagick svg to png conversion screws up text p

2019-08-21 09:32发布

问题:

Trying to use Imagemagick's conversion tool to do basic SVG to PNG conversions, but the text positions are completely out of whack.

For example, here's a vertical list of words in SVG:

SVG:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="360" height="360" version="1.1" style="display:block;">
  <rect width="100%" height="100%" fill="#FFFF00"/>
  <text x="0" y="20"  font-size="12" text-anchor="start" fill="black" transform="">HELLO</text>
  <text x="0" y="40" font-size="12" text-anchor="start" fill="black" transform="">HELLO</text>
  <text x="0" y="60" font-size="12" text-anchor="start" fill="black" transform="">HELLO</text>
</svg>

Which looks like this:

Convert with Imagemagick:

convert test.svg test.png

Result: test.png