batch automate bitmap trace

Post questions on how to use or achieve an effect in Inkscape.
Paul Newman
Posts: 1
Joined: Tue May 26, 2009 5:58 am

batch automate bitmap trace

Postby Paul Newman » Tue May 26, 2009 6:18 am

I'm using Inkscape's bitmap trace and save as EMF for import into SWiSHmax. It all works very well without even changing trace settings! However, I'm tracing a bitmap animation sequence which I've generated in 3D using messiah:Studio (numerous layers of black on white for clean tracing) and I desperately need to have this trace bitmap and save as EMF in a batch process.

I explored using the command line features (I'm running Inkscape on Windows XP) and so far I have the following working for me...

Code: Select all

inkscape -f d:\graphics\render\zoomdial050.tga --verb EditSelectAll --verb SelectionTrace

However, I can't get past the bitmap trace settings window which opens up and requires at least user input to say "OK" to proceed with the bitmap trace. How do I get this window not to appear or how do I get it to close by using the command line?

The other question is how to save as an EMF file (provided I get the image traced).

Then there's the question of using a Python script to achieve the same batch tracing automation.

Is this possible? Can my problems be sorted?

Or should I give up now and manually slog through bunches of animation files?

Please advise. Thanks in advance!

Paul_Newman
Posts: 1
Joined: Wed Oct 06, 2010 5:27 am

Re: batch automate bitmap trace

Postby Paul_Newman » Wed Oct 06, 2010 6:03 am

I gave this challenge another try and found a (free) solution for batch processing bitmap tracing and output to EMF files.

Download Potrace here http://potrace.sourceforge.net (141KB)
Download svg2emf.jar here http://code.google.com/p/svg2emf/ (4MB)

I trace black & white rendered bitmaps to SVG vectors and then SVG is converted to EMF for use in SWiSHmax.

Here's my workflow for anyone who may have a similar need...

Step 1: Render animation frames as BMP files into a folder
Step 2: Copy Potrace.exe and svg2emf.jar into the animation folder
Step 3: In Windows open the CMD window [START -- Run -- cmd] and from the command line change directory to the relevant animation folder
Step 4: Trace frames using >potrace -s *.bmp< where -s is SVG format (>< are not part of the command sequence, only used for clarity here)
Step 5: Using a batch file with one line for each animation frame, run >java -jar svg2emf.jar filename.svg< to convert SVG files into EMF format
Step 6: Import EMF files into SWiSHmax or app of your choice

Although the above is crude and does require the command line, it is fully automated and the results are perfect.

If you do not require EMF, then don't bother with svg2emf.
For other Potrace options run >potrace -help< on the command line. The default Potrace settings yielded very good results for me.

You may have noticed this solution does not make use of Inkscape but does make use of Potrace on which Inkscape's Bitmap Trace function is based.


Return to “Help with using Inkscape”