Advertisement


Batch trace JPG to SVG


Question

I have thousands of JPG graphics and want to trace them automatically to vector SVG files with a batch function in Adobe Illustrator CS4/CS5.

All graphics looks something like that:

enter image description here

My problem is, I have only Adobe Photoshop (CS5), Illustrator (CS4) and Bridge (CS5) on my machine. Is there any way to do it with this software?

I tried to make actions in Illustrator.

  1. I changed the [Default] preset with my desired options: Object -> Live Trace -> Tracing options. Here I changed the options to this and saved as [Default]: enter image description here

  2. I started to record my action: Object -> Live Trace -> Make. But by doing this, Illustrator choose the "Custom" preset, so I didnt get my desired options. Like you can see, the "Miminal area" is set to 2px (in "Custom" mode it is 20px).

So, is there any way to do stuff like that with Illustrator or should I use any other software (if possible free)?

At the end I want to save the file as SVG.

Thank you

2014/08/07
1
7
8/7/2014 2:09:00 PM

Accepted Answer

Potrace is free and you can do batch processing from the command line.

The first thing you need to do is converting all images to bmp format. There are several ways to do this but I use mogrify. Run

mogrify -format bmp *.jpg

Convert all images to SVG format:

potrace --svg *.bmp

The downside is that the quality of the conversion will not be as good with potrace as with Illustrator but I am rather sure that potrace is the best available option if you need a free program to generate SVG files from images with.

Mogrify is a part of the ImageMagick toolkit that can do much more than just converting images to a different file format.

Both image ImageMagick and potrace have released Windows versions of their programs but it is much easier to do this kind of processing on Linux. I might be worth it install a Linux distribution if you need to do this several times.

One key parameter that you need to change (if your images are as small as the example you provided) is the size of the image. This can also be done with mogrify. Here is one example (with monochrome settings) of what a traced image looks like.

Auto traces image

This example was generated with the following commands:

mogrify -resize 1000% -format bmp bAm4J.jpg

potrace -k 0.9 --svg bAm4J.bmp

2015/06/07
5
6/7/2015 8:52:00 PM