【发布时间】:2019-12-18 17:43:33
【问题描述】:
我是使用ImageMagick 的初学者。我有一个来自文件系统的简单svg 图像,我想将其转换为png 文件,所以我运行了:
$ convert -resize 100% ~/image.svg ~/image.png
错误是:
convert-im6.q16: non-conforming drawing primitive definition `px' @ error/draw.c/DrawImage/3265.
我的image.svg:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%; cursor: grab;" viewBox="-490 -155 1311 669">
<g stroke="#000" class="item" style="stroke-width: 3px; stroke-linecap: round;">
<rect x="273" y="149" width="126" height="111" stroke="transparent" fill="none" style="stroke-width: 30px;"></rect>
<rect x="273" y="149" width="126" height="111" fill="none"></rect>
</g>
<g stroke="#000" class="item" style="stroke-width: 3px; stroke-linecap: round;">
<ellipse cx="-167.5" cy="97.5" rx="209.5" ry="206.5" stroke="transparent" fill="none" style="stroke-dasharray: 5px, 5px; stroke-width: 30px;"></ellipse>
<ellipse cx="-167.5" cy="97.5" rx="209.5" ry="206.5" fill="none"></ellipse>
</g>
</svg>
我的ImageMagick 版本:
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
我的rsvg-convert 版本:
rsvg-convert version 2.40.20
【问题讨论】:
-
您要转换的 svg 文件是什么?从中删除东西,直到你有一个显示问题的最小示例。然后编辑问题以包含该最小文件。
-
哦,是的,很抱歉@RobertLongson
-
px 单位有各种各样的东西,是哪一个导致了问题?您可以通过删除属性来查找,直到找到为止。您需要
元素及其内容,还是只需要一个?
标签: svg imagemagick png imagemagick-convert librsvg