Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PNG to SVG in bulk
#1
does anyone know if i can convert 1000's of png files in to SVG files using Gimp?
Iv seen a few videos on how to do single files, but i have 16000 files i need to do.

thanks for your help.
Reply
#2
Gimp wouldn't be my first choice to do the conversion on a single file... Inkscape has a "Trace bitmap" function which is itself based on a potrace command-line tool, well suited for scripts.
Reply
#3
A real can of worms.

Gimp has a plugin autotrace_p.py which traces an image producing a Gimp path. It uses a utility called (surprise) Autotrace. Gimp on its own can not output an SVG image but as a side effect, autotrace makes temporary SVG file that you can retrieve.  Great for one at a time but no way I can see of using it in a batch for 1000's. The temp.svg file is overwritten each time.

You might as well go straight to using Autotrace on a command line. https://github.com/autotrace/autotrace/releases

One snag is format, autotrace uses bmp or ppm not png so you need a conversion first. For command line use ImageMagick http://www.imagemagick.org magick in.png in.ppm and using my boilerplate command for autotrace for a single file. You might need to change the color-count and dump the progress indicator.

Code:
autotrace -color-count 10 -corner-always-threshold  20 -corner-threshold 60 -output-format svg -output-file out.svg -report-progress in.ppm

Best for simple graphics

   

potrace is very similar to autotrace with this limitation The input is a bitmap, which means, a pixel-based image composed of the two colors black and white only. The bitmap is bmp or ppm

Another way is explore Inkscape command line which also uses autotrace. Never done that. Try their forum. https://inkscape.org/forums/

Other snags, Never very good with text.
Reply


Forum Jump: