This tutorial describes how to convert a digitally rasterized bitmap image into vector art. This process is called tracing or vectorization, and can either be done manually or using an automatic tool. In this tutorial, we explain how to use Vector Magic to perform this conversion quickly and easily.
This tutorial does apply to:
It does not apply to:
This tutorial applies only to bitmaps arising from the digital rasterization of a vector art original. This comes up when the original vector art has been lost or is inconvenient or time-consuming to retrieve. In this tutorial, I go through the process of re-vectorizing such an image.
This tutorial uses Vector Magic Desktop Edition. You can download a trial version from the desktop application page.
The Online Edition is very similar to the Fully Automatic mode in the Desktop Edition. The user interface looks slightly different, and there's no transparency support. With those caveats in mind, you can also use the Online Edition to follow this tutorial.
The image that I have chosen as an example is shown below:
This is a fairly high-resolution image (604x528 pixels), but also fairly typical of this category among the images uploaded by our users. I have also elected to use a PNG, rather than a JPG or a GIF, because I'd like to focus this tutorial on the basic work-flow, and not on the specific challenges of overcoming compression noise.
Let's get started. In this section, we will go through the steps that you should take to properly process this image in Vector Magic Desktop Edition. It may be helpful to follow along to get a feel for how the application works.
We start out by loading the image. This can be done from the clipboard, by dragging and dropping the image onto the application or its launcher icon, or by using the conventional file browse dialog. Pick your favorite method and load the image into the application.
Loading the image will take you to the wizard mode page (shown below). This tutorial will follow the Basic Wizard, so you should click on the second of the three big buttons on the Wizard Mode page.
This will take you to the Image Type page, where we must select which category of image we are dealing with. The three choices are Photograph, Logo with Blended Edges (anti-aliased), and Logo without Blended Edges (aliased). The icons associated with each of these categories illustrate the differences between them.
Go ahead and zoom in on this image to decide whether it is a logo with or without blended edges (i.e., whether it has anti-aliasing or not). You can zoom using the mouse wheel and can pan around the image using the hand tool by clicking and dragging the mouse. A close inspection of any of the edges present in the image will reveal that this image does contain anti-aliased edges. We therefore select the second option, Logo with Blended Edges.
You will note that this choice was also recommended and pre-selected by the program. This is a convenience feature to make selection easier.
Just like many other image viewers and editors, VM uses a checkerboard pattern to indicate the background (behind the image). So if an image contains transparent sections, as this one does, they will show through as the checkerboard. Transparency is supported by VM Desktop Edition but not the online version. This does require the user to make a choice. If the transparency is alpha-blended at the boundary (as is typically the case with PNG images), then the user should leave the transparency alone. If the transparency is implemented as a 1-bit transparency mask (as with GIF), but the rest of the image has anti-aliasing, then it is necessary to flatten the image to a suitable background color. This page (shown below) lets the user make this selection. In this case, the transparency is alpha-blended and we want to preserve the transparency in the vector result, so we will select 'Leave Transparent.'
The next option is the quality of the source image. The algorithm needs to know this so that, in the case of a noisy image, it doesn't mistake compression noise or other imperfections in the image as representing actual features to be reproduced in the vector image. In this case, the input image is a very clean, crisp PNG, with no noise. It is definitely a high quality image, so we will select that choice (see below). But be sure to zoom in on any given image to take a close look. Sometimes an image can appear clean and crisp when zoomed out, but defects become apparent when inspecting it in detail.
The next choice determines how the colors to be used in the vectorized result are selected. "Custom colors" means that you can select the exact set of colors to be used, while "unlimited colors" mean that the algorithm will pick them automatically. In general, one should pick "unlimited colors" when there are lots of colors in the image, and "custom colors" when there are very few. But it is also sometimes sensible to pick "unlimited colors" even when there are very few color because that option takes less time. In this case, I'd like to demonstrate the process of picking the "custom colors," so I'll make that choice (see below).
For the "custom colors" mode, the user must select the specific set of colors that he/she wishes to have included in the vectorized result. On this page, several "Quick palettes" are shown that the user can select from. Selecting a quick palette causes that palette to show up in the box at the top of the page. Individual colors in the selected palette may be edited or deleted by clicking on them, and additional colors may be added by clicking the "+" icon. In this case, the seven-color quick palette is the correct choice (see below), so we select it and move on. The arrows to the left of each quick palette indicate whether the program thinks it is a likely candidate. The double arrow is the program's best guess. In this case, the best guess (nine colors) was not correct, but it was just a matter of one click of the mouse to correct that mistake. After selecting the correct palette, we hit "Next" to move on to start the vectorization job.
The vectorization process takes a minute or two, depending on how fast your processor is. Once it is done, you will find yourself on the "Review result" page. On this page, you can quickly reprocess the image with slightly changed settings, or you can edit it manually. Though the result looks good when viewed zoomed out (see below), there are a couple minor defects. I will explain how to fix those defects in the coming few screen shots.
The following two images show a detail on the soldier's helmet that is badly reconstructed. Though slightly ambiguous, it does appear as though the yellow—not the black—should have been connected at this narrow point. In the second screenshot below, the outlines of the vectorized result are shown over the bitmap original. In order to fix this problem, we click the "Edit Result" button at the bottom of the troubleshooting options.
The segmentation editor works much like Microsoft paint, or any other simple bitmap editor. It allows the user to make manual edits to a coarse, pixel-aligned version of the vector image. This is particularly useful for correcting mistakes like this one, where the wrong shapes are connected. In this case, the top black shape and the bottom black should should not be connected but are connected. The first screen shot below shows the segmentation as it originally was computed by the program.
In order to fix that, we select the eye dropper tool and click on the yellow color somewhere in the image. Then we change the top-left-most two black pixels of the bottom shape to yellow using the pencil tool. This connects the two yellow shapes and separates the two black shapes, as shown in the screen show below. After making this change, we click the "Update" button to apply the changes.
Finally, after the re-processing is complete, the resulting vector image looks much better (see screen shot below). The two yellow shapes are connected and the two black shapes are not.
Now, let's just look at a couple other spots in the image to see how things turned out. The two screen shots below show the original bitmap image (first screen shot) compared to the corresponding vector image (second screen shot). As you can see, the program did a nice job of reconstructing the underlying vector image. Corners are sharp where they should be and curves are smooth where they should be.
Here is another view that shows the outlines from the vector image superimposed over the original bitmap image. As you can see, nodes are generally placed in very sensible locations, and the vector image very closely follows the actual shape boundaries in the original bitmap. That the edges in the vector image slice right through the anti-aliasing in the original bitmap is one of the best features of Vector Magic in comparison to other auto-tracing tools.
Once you are done reviewing, just click the "Done Reviewing" button, or click "Next."
That takes you to the page for saving your vectorized result to the hard disk, or dragging and dropping it on another program. In this case, I've elected to use the "Quick Save" feature. Quick save allows you to save the vectorized result to the specified directory and using the specified file format with a single click. The directory defaults to the same directory that the source image came from and the file format is a sticky setting, which means it will be whatever you last chose. The filename defaults to be the same as the bitmap name.
After you've saved the image to disk, you can load it up in your favorite vector editor. I like Inkscape because it is free and has most of the features that Adobe Illustrator has. In the screen shot below, I've loaded my SVG file up in Inkscape and am using the magnifying glass zoom tool to zoom in on the small highlights on the helmet.
Upon closer inspection, I can see that the two smallest highlights, which should have turned out as rounded ovals like the big highlight, were mistakenly reconstructed as having pointed ends, like a lopsided football. This is not something that can be fixed in VM itself, so I'll explain how to fix it in Inkscape. The corresponding operations would also work in Adobe Illustrator or CorelDraw. First, select the nodes at the sharp corners using the node selection tool (second tool from the top in the side toolbar). Then click the "make selected nodes smooth" icon in the second row of the top toolbar. This button is indicated in the screeen shot below.
Then do the same thing with the other offending oval. If either oval needs to be moved to compensate for its changed, shape, you can do that with the primary "select and transform objects" tool (the regular mouse-cursor tool that is at the top of the side toolbar). After those modifications, the result should look like this.
And that's it! This tutorial was intentionally written to be very thorough, so it is a bit long-winded at times. Once you get the hang of this, it will become very quick and easy to convert bitmap images into vector art. While the algorithm built into Vector Magic is state of the art, it is not perfect, so we have included a manual editing feature. Even that feature won't let you fix everything, so I've also explained how you can use a regular vector editor to help clean things up after the fact.
Good luck, and happy vectorizing!