EDIT: I just found out about Vectorize it! looks promosing

 

"Talent Borrows, Genius Steals." Ok, so that quote isn't always true but it makes for a pretty good segue into this post. 


Occasionally you will find yourself in need of a way to convert a raster images into CAD. There are likely several ways to do this, and there are probably better ways than this, but screw them.. I'm doing it this way... at least this time. If you don't know the difference between raster and vector images, I discussed very shortly the difference in a post I did on converting vector pdfs here: Converting PDFs to CAD.

To elaborate further the difference between vector and raster, a raster image contains a discrete description for each pixel involved in the image, where Vector images contain directions on how to build the image. So raster would say something like pixel 148 is green where a vector says there is a line that follows this path that is green. Another way to think of it is like driving directions. If you described driving across the road to your neighbors house in raster it would look something like this. It would say: inch 1 you are facing north, inch two you are facing north, inch three you are facing north and so on and so forth until you had arrived at you destination. Now to describe the same journey as though it was a vector you would simply say, go north for 30 feet. The value in vector images is in simplicity and accuracy. 

Back to converting.. I have used this method a few times with varying degrees of success. It works best with simple images like silhouettes. When you start adding other colors and shading the translation is really lost in CAD. I have used this method to create CAD versions of things like safety signs, road signs, written signatures etc.. basically the more 2D and cartoonish the better the results. Simple bold colors and clear outlines. Some times you can find these images already converted in block libraries so don't start here first. you should probably look in these library first and see if they are available in your block library or the multitudes of blocks available online. There is no sense in wasting time if some one else has wasted it for you already. 

In this example I'm going to convert the ubiquitous symbol of male machismo, the trucker girl, into a drawing that I can add to my AutoCAD block library. I did a quick google image search to get a general idea of what i was looking for and made a template using gimp (a graphics program). I altered my image so I could tailor it to my specific needs. 

So the next crucial step is to download and install a opensource program called inkscape

Inkscape is opens source but there may be some stuff to look at if you are going to use it commercially. Once you install the program the simplest way is to go to your raster file and right click and select 'open with' and then select inkscape. Other wise just open inkscape and then open you image you want to convert. 

Once its open you want to select the image. Use the little arrow and click on the image. This will make the arrows show up aorund the image. This is how you know you have it select. 

 

 Next go to the path menu and select 'trace bitmap' This will be the part that creates a vector from your image. 

Once you click this will bring up the a dialog with lots of options. once you have an understanding of some of what going on you can play with these to get a better performance out of your conversion. For my purposes i need something simple. I select the colors radio button and change the number of scans to 2. The scans will be imported as polylines into CAD. So with two scans I'm going to have to clean one set of the polylines out of the image once its in cad so you definitely want to lower this if you can to save you work in CAD. Some images require more scans to get better fidelity, but this is one of those you will have to let you conversion dictate that setting. I also select to remove background cause i don't want the back ground sent to CAD. To get an idea of what the oput will look like while you adjust the setting hit the update button. If there is no image there you wont be converting anything. Once you are satisfied click OK. 

Clicking OK doesn't close the converting dialog (at least on the distro I'm using) so just click the x to close the dialog. 

 Once this is done it may not look like anything was done. you have to click the image and slide the image sideways. It should become apparent then that you have successfully converted an image. the next step is to select the rater image and delete it. once you delete the raster image move the vector image back into place in the work area. 

If you like you can change the image within the inkscape program but as this is about just the conversion i wont go into using inkscape. I will say i have used inkscape on personal projects and I'm a pretty big fan of it. Once the converted image is centered and the raster image is deleted the next step is to export to dxf. Simple go to the file menu and select export. You can export to several different formats so make sure you select .dxf in the export dialog. 

 There is another dialog after this one, just click OK and you are done... at least with this leg of the work. 

The next step is to bring it into AutoCAD. You can simply open it by click on the file or by opening CAD and selecting it. Since its a dxf you may have to change the file type in the open dialog. You can also insert it as a block using insert. 

Since this was a simple image there was very little cleaning I had to do in CAD. Normally there will be things that are a little off and polylines that don't connect. You will also notice the that final image is not hatched and it is just an outline. So if you need it hatched you will have to really examine the polylines and make sure they are closed when you try to hatch them in or that you hatch gap is set sufficiently to allow for it. 

Well there you have it. A semi simple way to convert raster images to CAD. Penis. Sorry, I had gone to long with out being inappropriate so I had to throw that in.