ImageMagick: non-conforming drawing primitive definition `px'

2.2k views Asked by At

I'm a beginner at using ImageMagick. I have a simple svg image from the file system, and I want to convert it to png file, so I ran:

$ convert -resize 100% ~/image.svg ~/image.png

And the error is:

convert-im6.q16: non-conforming drawing primitive definition `px' @ error/draw.c/DrawImage/3265.

My 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>

My ImageMagick version:

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

My rsvg-convert version:

rsvg-convert version 2.40.20
1

There are 1 answers

0
fmw42 On

I ran the following command fine on IM 6.9.10.60 Q16 Mac OSX where ImageMagick is using Inkscape to do the rendering. It also worked using IM 6.9.7.4 with RSVG 2.44.13_0.

convert test.svg test.png

and also

convert test.svg -resize 100% test.png


enter image description here

Your syntax is not correct for ImageMagick. You should read the svg file or any input image before doing -resize.

You can try to upgrade to the latest RSVG. You are several versions behind.

Or install Inkscape and ImageMagick will use it in preference to either RSVG or ImageMagick MSVG/XML internal renderer.