0

我正在尝试渲染分辨率为 4000x4000 的 SVG。我正在使用的命令是:

rsvg --keep-image-data -w 4000 -h 4000 big.svg try.png

一个 svg 样本是:

        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="406" height="406">
           <clipPath id="slot-1">
              <rect x="0" y="0" width="45" height="45" />
           </clipPath>
           <clipPath id="slot-2">
              <rect x="0" y="203" width="45" height="45" />
           </clipPath>
           <image clip-path="url(#slot-2)" x="1" y="170" angle="0" width="80" height="45" preserveAspectRatio="none" xlink:href="file:///var/www/myposter/web/application/../../storage/public/2017/04/0/b/f/8/4/0bf841426d859a99b0736766eca9d353ad9c9fd2_base.jpg" />
           <image clip-path="url(#slot-1)" x="1" y="-29" angle="0" width="76" height="45" preserveAspectRatio="none" xlink:href="file:///var/www/myposter/web/application/../../storage/public/2017/04/1/0/9/6/0/10960d9aa853b49dac548887595c829b32aa5107_base.jpg" />
        </svg>

图像大小为 2MB - 24MB。

最后,事情崩溃了,并给了我“分段错误”。

如果我用 1200x1200 的分辨率做同样的事情......

rsvg --keep-image-data -w 1200 -h 1200 big.svg try.png

它按预期工作。

4

1 回答 1

0

该过程只是达到了内存限制,因为 svg 中引用了很多高分辨率图像。

所以解决方案是获得更多内存或使用较小尺寸的图像

于 2017-04-13T14:40:06.250 回答