-> User's Manual -> BMP2SVG

BMP2SVG User Manual

Date: 10/20/10
Rev: 0.0.0
Authors: Bernard Alala and Joe Doll

Pac-n-Zoom Color    -    The need for segmentation

What Is BMP2SVG?    -    A description of BMP2SVG

Usage    -    How to use BMP2SVG

Editing    -    Editing the SVG File

    Computer images can have either raster or vector formats.

    Raster images are composed of pixels (dots of light or paint). The bitmap (BMP) is the lingua franca of raster graphics. Every electronic sensor intrinsically delivers raster signals, so nearly all images start in raster.

    Vector images are composed of mathematics. Computers can do very little with the disconnected dots of raster, but computing machines are right at home with mathematics. Most computational engines (e.g., drawing programs, animation engines, simulated environments, and several hundred others) require mathematical equations, and in those cases that don't, the power of the calculation is dismally lacking because they rely on inferior tecniques such as the discreet cosine transform. Vector is the goal, but raster is the reality.

Pac-n-Zoom® Color
    No transducer is perfect and electronic sensors are no exception. Besides delivering data as a bunch of disconnected dots, raster data is extremely noisy. Someone (either man or machine) has to pick the data from the noise, or the data is useless. In a machine, color segmentation has historically been used for this purpose. Segmentation is used to extract the signal from the noise. For example, imagine an animal in the forest, the viewer must be able to determine which dots belong to the animal from those of the forest. If the viewer fails, the animal is camouflaged by the forest.

    Until recently, segmentation was usually limited to black and white. Various technologies experimented with color averaging thresholds, but the results were inaccurate when the image had multiple colors. Pac-n-Zoom Color uses edge detection segmentation (segments like a human) to extract the signal from the noise. We highly recommend that images are segmented (cleaned up) before they are vectorized (turned into mathematics), lest noisy images create messy mathematics.

What Is BMP2SVG?
    BMP2SVG is a raster to vector converter that takes in a BMP file and outputs a SVG file (probably didn't need to say that).

    BMP2SVG is a fork of Autotrace, where BMP2SVG is different from Autotrace is several significant ways.

  • CLI: The CLI in BMP2SVG is Windows® based, whereas Autotrace is based in DOS which makes Autotrace questionable in either Vista or Seven unless it is compliled under that OS.

  • GUI: BMP2SVG comes with a GUI. A GUI can be arranged in Autotrace, but it requires extra work.

  • Math: BMP2SVG converts to both polylines and Bezier curves, whereas Autotrace is Bezier curve or bust. Bezier curves produce better interpolation between pixels, but they lack the ability to follow the borders of small blobs. Since polylines always follow the border, BMP2SVG uses polylines on blobs that are smaller than the "spline" setting and Bezier curves on the rest.

    BMP2SVG has 2 interfaces, CLI and GUI.

    To use the GUI, follow these steps.

  • Load: Load a BMP image into BMP2SVG.

  • Set: Set the spline value.

  • Save: Save the image to a SVG file.

    The following gray box contains the general form of the CLI.
BMP2SVG [options] input_file.bmp
    You can use "--" or "-" to start an option.
    You can separate option names and values with " ".
-help: print this help
-output-file filename: write to filename
    which should have a SVG extension.
-spline ###: ### is between 0 to 65535
    number of points required in the polygon outline to apply spline curves. input_name should be a BMP image.

After the image has been converted into an SVG format, a vector graphics editor can be used to edit the file.

Bezier curves are complex mathematical functions that often lack the flexibility needed to cover all the background of small blobs (hence the "spline" setting in BMP2SVG), but Bezier curves produce better intepolation between pixels which may make it desirable to set the "spline" setting as low as possible. These low settings can leave background areas that need to edited in SVG. Nearly all vector graphic editors such as Adobe® Illustrator®,Inkscape (free), or CorelDRAW® can edit SVG. We will use Inkscape to demonstrate how to pull the Bezier curves over the background.

To be clear, if the "spline" setting is high enough, no editing is required, but smoother pictures (better interpolation) can be achieved with lower "spline" settings.

To edit Bezier curves, we load our vector file, bee_seg-10.svg, into Inkscape which produces the following screen shot.

Inkscape screenshot:

We would then zoom in on any area where the background is showing by clicking "View", selecting "Zoom", and the clicking "Zoom In". You can also simply press the '+' or '-' keys.

The following screen shot is a zoomed view of a problem area.

Screenshot before adjusting the vertices:

The white parts are the areas that are not covered. This is because the spline setting is a bit low and Bezier curves can't handle smaller blobs.

This problem can be eliminated by increasing the spline setting. You can also pull the vertices over manually so that the whole area is covered. To adjust the vertices, select a single blob. Inkscape will display the vertices of the blob when the blob is selected. These vertices can be used as handles to pull the blob over the part that needs to covered. The blob will "rubberband" (stretch) to cover the entire area.

Pulling the vertices of the blobs will cover the entire image as shown below:

Screenshot after adjusting the vertices:

The areas that were enlarged are within the dotted rectangle.

© 2010 - 2011 Accelerated I/O, Inc, All rights reserved.