Search code examples
imagesvglatexinkscape

inkscape save image svg does not store curve


I have a svg file with xml code

enter image description here

The code

convert curve.svg curve.png

works fine.

But using inkscape:

inkscape -e curve.png curve.svg

Background RRGGBBAA: ffffff00

Area 0:0:1000:600 exported to 1000 x 600 pixels (90 dpi)

Bitmap saved as: curve.png

Gives me an image with no curve:

enter image description here


Solution

  • Inkscape does not appear to like commas in the d attribute value of <path>. I don't know if this is a bug, a known limitation, or because of the SVG spec; don't really know much about SVGs--sorry. :-)

    However, if you remove the commas from the value of d, it seems to work fine.

    One possible way to do this on Linux is with a simple Awk command (not very robust, but works for your particular file--just what I tried in troubleshooting):

    awk '/<path /{gsub(", L", " L")}{print}' with-commas.svg > working.svg
    

    If you find you need to massage the XML in a "production-grade" application, please use an actual XML parser and remove the commas appropriately, rather than relying on my silly Awk script. :-)