0

I have a folder with a bunch of .PNG files that I would like to convert to .SVGs. I downloaded Inkscape and was able to manually convert a few of them, but soon I will need to convert a lot of .PNGs to .SVGs and it will not be feasible to do it manually.

I looked into Inkscape's shell feature and activated it as follows on the terminal on Mac Big Sur:

/Applications/Inkscape.app/Contents/MacOS/inkscape --shell

but then when I use this code:

--export-plain-svg /Users/Downloads/pictures/testpic.png

I get the following error:

Unable to find: --export-plain-svg /Users/Downloads/pictures/testpic.png
verbs_action: Invalid verb: --export-plain-svg /Users/Downloads/pictures/testpic.png
Meowsleydale
  • 439
  • 5
  • 15
  • Does this answer your question? [Convert PNG to SVG using python](https://stackoverflow.com/questions/31427903/convert-png-to-svg-using-python) – user16930239 Sep 26 '21 at 19:18
  • I've heard popytrace is only black and white, but would need color functionality, which I have heard inkscape shell has, but there seems to be minimal documentation – Meowsleydale Sep 26 '21 at 19:20
  • 1
    @Meowsleydale: Do you mean how to batch convert PNGs to SVG using Trace bitmap? – s.ouchene Sep 27 '21 at 07:19
  • Well, what I want to do is take a bunch of .PNG files and somehow batch convert them to .SVG files, retaining full color, but theres not much documentation out there. – Meowsleydale Sep 28 '21 at 00:40

2 Answers2

2

(Not a solution, but a clarification)

Inkscape's command-line option --export-plain-svg simply removes some XML metadata from an existing .svg file. The option --export-plain-svgdoes not do this: "import the PNG, automagically converts/"vectorize" it, then export it as SVG."

The feature that you need is called "Trace Bitmap" (Menu Path / Trace Bitmap, or SHIFT+ALT+B) (example). Also the "Fill Bounded Areas" AKA Paint-Bucket Tool (U) can be used for tracing shapes within simple PNGs. Both of these require some manual experimentation first.


Specifically --export-plain-svg removes XML attributes that are in these namespaces:

xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"

("sodipodi" is a veryold precursor-project name, before the renaming to "Inkscape" happened, AFAIK)

knb
  • 9,138
  • 4
  • 58
  • 85
  • Hey thanks a lot for this response, in that other thread, what would he have had to have used in order to get it traced and colored, and saved as a svg? Really appreciate your help with this, as it seems documentation is sparse, and your post is helping to clarify it. – Meowsleydale Oct 02 '21 at 18:45
2

Try https://www.visioncortex.org/vtracer (https://github.com/visioncortex/vtracer) Opensource tool to convert color pngs to svg, Inkscape is not ok with colors AFAIK

IPv6
  • 405
  • 4
  • 17