OS/2 eZine - http://www.os2ezine.com
Spacer
April 16, 2003

SciTech SNAP Graphics for OS/2 and Linux


KVEC

How often have you wished there was a convenient way to convert a bitmap you have scanned into a vectorized image that you can manipulate in drawing programs like: Draw-It, CorelDraw, BlueCAD, AutoCAD? There is a very handy command line utility that allows you to do just this, KVEC. It is written by a German programmer Karl-Heinz Kuhl. KVEC is distributed as shareware and is available for multiple platforms. Registration for private use costs $25 and for commercial use costs $50.

Installation

The latest version at this moment is 2.97 You can download it from kvec_os2.zip (http://www.kvec.de/kvec_os2.zip). Installation is very straightforward. Create a directory where you want to install KVEC in and unzip the file kvec_os2.zip into this directory and that is it.

Usage

KVEC has a lot (and I mean a lot) of options you can configure. If you just type kvec on the command line, you get an overview of the options that are available. If you want to know more about a certain option you have two choices. You can look it up in the accompanying documentation in the file kvec.txt or you can type the command

kvec -ehelp option
e.g. kvec -ehelp bezier

KVEC supports vectorizing the following bitmap formats: TIFF, BMP, PCX, TGA, SGI, IMG, PNM, JPEG, GIF, WPG or FAX. The bitmap can be converted to :

Suppose I have the following image scan.bmp

Suppose I want to import this in a CAD system (e.g. to project it onto a double curved surface and to engrave it on this surface.) In this case I must have a smooth approximation with a minimum of points. Therefore I choose to convert the image to B‚zier splines. Because I get a minimum of points it doesn't take a lot of memory and I can manipulate the vectorized image easily. If you want the image to be converted to B‚zier splines you must also pick an output format which supports B‚zier (ps, eps, ai, wmf.) If you choose to convert it for example to DXF you'll loose the B‚ziers and you'll get polylines with a linear interpolation with many many points which makes it more difficult to manipulate in a CAD system.

I can start the conversion with the following command:

kvec scan.bmp scan.wmf -bezier -voblack nwhite -format wmf -monitor

scan.bmp : the bitmap I want to convert.
scan.wmf : the file that contains the vectorized image.
-bezier : I want the curves to be converted B‚zier splines.
-voblack nwhite : all colors except the brightest color will be vectorized.
-format wmf : the output format is wmf.
-monitor : I want to see the progress kvec makes while converting.

As you can see in the following image which shows the resulting wmf file imported in CorelDraw, the regions and the colors of the original bitmap are preserved.

If you don't want this and you only want the outer lines you can do the following. Load the bitmap in PMView, now reduce the number of colors

Now with the option Color -> Edit Palette, you can replace all colors with white except the outer contours. You'll then have the following result.

Convert this image to black and white and save it as BMP. Now unleash the power of kvec with the following command

kvec scan2.bmp scan2.wmf -bezier -format wmf -fill line -monitor

You can see the resulting wmf file imported in CorelDraw in the picture below.

Additional Information

The author Karl-Heinz Kuhl can be contacted at Karl-Heinz Kuhl .

Don't forget that all this software is written by the author in his own spare time so if you like this software, please send a sign of life and your appreciation to him and register the software. This way he knows his work is valued very much and it will give a stimulation to develop new versions. If anything isn't working as expected don't start to yell but try to provide the author with a full reproducible error report so he is able to correct the problem in case of a bug.

And then

And then it is up to you. KVEC has a lot of options I have not mentioned so there is a lot to be discovered.


John Bijnens is a CAM/CAM engineer in the KHLim - Dep. IWT (http://celkunststoffen.khlim.be) which is some kind of technical university in Belgium. He gives training in Pro/E and also writes CNC postprocessors (all development is done on OS/2.)

This article is courtesy of www.os2ezine.com. You can view it online at http://www.os2ezine.com/20030416/page_4.html.

Copyright (C) 2003. All Rights Reserved.