Raster to Vector

MagicTracer Conversion Software
[ Documentation ] [ Getting Started: 2 ]

Getting Started With MagicTracer Part 2

Step 1. Start with an image file

Start MagicTracer™, and open the sample image file scannedimage.png (shortcut key Ctrl+I or menu command File -> Open Image | Read More). The image file should be located in the “Getting Started 2” folder of your MagicTracer installation. This image is a scanned pencil sketch, which has been scanned at fairly low resolution for demonstration purposes.

Step 2. Refine the image

The original sketch was obviously not aligned well on the scanner, so we’d first like to give the image a proper horizontal and vertical orientation (this will better enable the vector conversion command to detect horizontal and vertical lines). To do that we must activate the Rotate command (shortcut key R or menu command Image -> Transform -> Rotate | Read More). Move the cursor so that it is over the left end of one of the blue graph paper lines, and left-click to set a point there. Click again on the right end of the same blue line.

The Rotate confirmation window appears; it should report an angle of approximatey 0.5 to 0.75 degrees; depending on where you set the two points, the angle you get may vary somewhat, but it should be close to this range. Set the Interpolation method to “Bicubic 2 (soft),” Overflow method to “Background (or [0,0] color),” and uncheck the “Keep original size” checkbox. Click OK to rotate the image.

This might be a good time to save the project. We have provided a pregenerated project GettingStarted2.mtp in the Getting Started folder.

For a more complex or noisy image, we might need to do further refinements on the image, such as adjusting the brightness, smoothing out noise, edge tracing, or other procedures to help enhance the parts of the image that we want to trace. For this image, where the edges are already fairly well-defined, we can proceed directly to vector conversion.

Step 3. Contour Detection and Vector Conversion

Use the Vector Convert command (shortcut key V or menu command Vector -> Vector Convert | Read More) to begin the process of converting the image to vectors. Anytime you start the Vector Convert command from a color or grayscale image, MagicTracer will first attempt to reduce the image to black-and-white contours. (If you start Vector Convert from a pure black-and-white drawing, you have the option to skip this step.) This stage requires some input from the user, so the following dialog box will be displayed:

Activate the Enable Real-time Preview box, then play with the controls to see how they work. For this image, we settled on the following settings as shown above:

After accepting the Contour Detection settings, you will be presented with a Vector Convert dialog box:

You should activate the “Enable Real-time Preview” option and play with the sliders to see how they affect the vector results. After some experimentation, we chose the following settings for this image:

The project thus far has been saved as GettingStarted3.mtp; if you have followed along your image should now look something like this:

Step 4. Clean up the vectors

After the vector conversion, the new vector entities are displayed on a pale green background. We can see that there are a few gaps in the vectors that were created, and a few stray corners that we might want to get rid of. Activate the Vector Select command (shortcut key S or menu command Selection -> Vector Select | Read More), and click on the small line segment in the far upper left corner of the image. Notice how the object shows tiny square boxes at the ends. These boxes represent the points that make up the vector entity:

We don’t need this corner segment. Press the Delete key to erase it. Now select the three top line segments to the right of the top corner line. We will delete these lines also (Delete key), and close the big gap in our next step.

Note: We will be doing a lot of point and line manipulation, the following command references may come in useful:

Sometimes we want to move a point so that it is exactly in the same location as another point. This is useful when we want to close a gap between two lines, for example. This is done using the Gravity option. Select the horizontal line at the top left corner. When it is selected, hover the mouse over the right-most endpoint. The cursor will change shape to a circle with four arrows. Left-click on the point to grab it.

Now as you move your cursor, the point will move with it, and the line will update accordingly. Move the mouse close to the left end of the next top line to the right, and right-click. The selected point should snap exactly to the point closest to where you clicked.

Next, with the corner piece still selected, hold the Shift key down and left-click on the line to the right to select it also. Combine these two lines into one line with the Vector Combine command (shortcut key F8 or menu command Vector -> Vector Combine | Read More). Now hover the mouse cursor over the point in the middle of the line. Press and hold the ALT key – when the cursor changes to a small square in a circle with a minus sign above it, you can left-click to delete that point.

Sample project GettingStarted4.mtp shows our progress so far.

Another useful feature is the Gravity Running Snap (menu shortcut Alt+S, R, G or menu command Selection -> Running Snap -> Gravity Running Snap | Read More). Using the tools you’ve just learned, try cleaning up the large inside corner piece as shown here:

We have provided a cleaned-up version of the project, modified using the techniques described above, as GettingStarted5.mtp.

Step 5. Save the vector data

Of course, the ultimate goal of the vector conversion process is to obtain a file that we can load into a vector graphics program or a CAD program. MagicTracer can save files in two popular CAD formats: DXF and DesignCAD. MagicTracer can also save files as SVG and EPS two popular formats for graphics programs.

We’ll save this one in DXF format, which may possibly be the most widely accepted vector format on the planet. To do so, activate the Save Vector File command (shortcut key Ctrl+Shift+S, menu command File -> Save Vector File | Read More). Under the “Save as Type” option, choose DXF files. Then enter a filename, such as “gettingstarted2.dxf,” browse to your preferred save folder, then click the Save button.