Autotracers are great time-saving tools that can save you hours of monotonous hand tracing, but they are often misused. In this tutorial we will look at two real world autotracing examples using Inkscapes built-in autotracer (also known as a bitmap tracer). Our goal in all of these examples is to create a clean black and white vector. You will see that autotracers are very limited in what they can do.
Before we start looking at examples let’s first get familiar with Inkscapes autotracer. Open up Inkscape, click on the “Path” menu and select “Trace Bitmap”.A sidebar will appear on the right. On the right of the dialog there is a preview window, if you select a bitmap and click the Preview button it will show a preview of what the tracing will look like. This is very useful when you are tracing complicated images that take along time to trace.
On the left there are different tracing methods, the top three create only a single path. There are several different ways of tracing a bitmap. The first option, Brightness Cutoff, works similar to GIMP’s Threshold tool. It creates only one a black path of the areas of the image that are darker than the threshold value. By adjusting the Threshold value you can control what is considered black and what is not. The second tool is Edge Detection. This tool uses an algorithm to determine what parts of the image are edges and what are not. If part of the image is considered an edge it becomes part of the black path. By adjusting the threshold value you can control what is considered an edge and what is not. Higher value mean less of the image is consider an edge. The third option is Color Quantization this option creates adds a path where the colors in the image change. By adjusting the the Color value you control how many different colors the image should be considered. The bigger the color value the more outlines it creates.
The next three options create multiple paths. The first method for creating multiple paths is Brightness Steps. This divides the image into different increments of brightness and covers each one with a path of the appropriate brightness. The next option is Colors, this option creates a path for each area color. The third option is Grays, this option divides the image into different increments of brightness and covers each one with a path of the appropriate color, this option works very similar to the Brightness Steps. By adjusting the amount of scans you control the how many increments of brightness there are.
There are several more miscellaneous options for tracing. There is the Smooth option that smooths the curves after being traced. The Stack Scans options stacks the brightest paths over the darker ones, as opposed to cutting out the darker paths. The Remove Background option removes the lowest, or darkest, scan from the tracing. The Invert image checkbox inverts the image before being traced, I bet your glad I explained that one!
Now if you click on the Options tab on the top you will see three more options. Suppress Speckles, this option suppresses speckles in the bitmap by ignoring small details in the tracing. The bigger the Size value the smoother the tracing (and the less detail). The second option is Smooth Corners, this option smooths the sharp corners of the path. A higher threshold means smoother corners. The last option is Optimize Paths, this option uses an algorithm to create the paths with the least amount of nodes necessary, i.e. cleaner paths. Always leave this option on if you are not going to manually edit the path later.
There are no perfect settings. Each image you trace will need slightly different settings based on the quality and type of image.
Tracing a Photograph
Here we have a relatively high contrast image with fairly clean lines. Our goal is to make a black and white tracing of the mouse and cord. It seems like Autotracing is the way to go. So lets autotrace this image and see what happens. Import the image into to Inkscape and click on the path menu and select “Trace Bitmap”(Note: the image being traced is a higher resolution than the one you see above). Select the image and click the preview button in the Autotrace dialog. I chose Brightness Cutoff as scanning method. Adjust the threshold value up or down if necessary and click the preview button to see the results. Once you have got it the way you want it click ok. Then delete the image. Now let’s zoom in and inspect the path. Zooming in to where the button on the mouse meets the front of the mouse we see a weird outline. Not only does this not look correct it also is impossible to edit.
A path should have relatively few control points and be fairly simple. Lets view the control points or nodes as they are called in Inkscape. Click on the edit tool and then select the path to see the nodes. There are so many nodes the path impossible see, let alone edit!
This image cannot be traced correctly by the autotracer. This is a relatively simple image that will only take a few minutes to manual trace. If you tried to clean up the autotraced path you would spend more time cleaning up the path than you would just tracing it manually, and you would end up with a poorly traced path. Manually trace this image.
Tracing a 3D Image
A 3D image like this one is not a whole lot different than a photograph. The only major difference is there is less noise and the image is a lower resolution. Due to the low amount of contrast in this image we will not be able to use Brightness Cutoff, in fact we will not be able to use any of the single path tracing options. I found that for this image that the Colors and Grays options worked the best. Of course our goal was to create a black and white vector image, so I had to do a little manual editing of the paths to make them black and white.
Now lets zoom in and inspect the path. The path is fairly accurate and has a good amount of detail, there are no funny outlines like we saw in the photograph and the outline is easy to recognize. Now let’s select the edit tool and click on the path. The path is covered in nodes and is way too cluttered. It is nearly impossible to edit and is not much better than the tracing of the photograph.
The best way to trace this image would be to do it manually, but with all the detail it would take hours. You would probably be better off if you just spent an hour or so cleaning up the autotrace manually. Either way you could not use the autotrace alone.
The Best Way to approach Tracing
I feel that the best way to approch tracing an image is to first try autotracing (or just previewing it if you have detailed image) with all the different different tracing methods. If you find one that gives fairly acceptable results go with autotracing and do a little cleaning up of the nodes manually. If you find no acceptable tracing method, manually trace the image yourself. What ever method you choose always check the path for excess nodes and do editing if necessary. Manually tracing always produces better results. Do it if you can afford to spend a couple hours tracing!