Using Inkscape to convert TIFF to DXF

Submitted by Nicola Rainiero on 2012-09-19 (last updated on 2013-04-01)

In this short tutorial I will explain how you can convert cartographic maps available in TIFF format to DXF, a vectorial standard available in most CAD software. The final result, nevertheless with some limitations and lacks, allows you a more productivity and improves the quality of design.

Sometimes I have to draw over a raster image, and if it is a map, I have many details to modify or semplify. Luckily in my Region, through the GeoPortale Regionale, I can download maps in DXF format, like you can prove clicking in this page Infrastruttura dei Dati Territoriali del Veneto - Catalogo dei Dati. Other Regions don't have this chance and most I can obtain is a TIFF georeferenced.

Well, if I have to do small additions in this file, I can simply import it in CAD like a raster image. Otherwise I use Inkscape, vector graphics editor GPL licensed, to convert the maps in DXF format.

Main steps

In these cases I perform the following operations:

  1. Analysis of the source image: clean, fix some contour and selection of the interested part. I use GIMP,  an image retouching and editing tool released under GPLv3 license, to do this modifications. If like me, you don't have a powerful workstation, I suggest you to select a very little portion of your image and make experiments on it. Then extend your settings to whole image (in this manner you can save time and hardware resources).
  2. Load resulting image in Inkscape with File --> Import (or Ctrl+I) and then after selected it click on Open, you can link (less resources used) or embed image.
  3. Select image with left buttom of your mouse and click Path --> Trace Bitmap (or Maisc+Alt+B)
  4. Convert choosing one of two procedures:
    • Brightness cutoff, based on a given brightness level;
    • Edge detection, based on J. Canny's algorithm.
    The menu allows you to change the threshold value (on the right side) and with an Update button you can view the preview. When you obtain a satisfactory result click on OK button. Using Edit --> Undo (or Ctrl+Z) you can remove the last operation and restart again with the conversion.
  5. Reduction of the resulting vector graphic (i.e. the number of the total nodes that describe the image): select the image and enter in Edit paths by node modality (second icon at the top of the toolbox on the left side, it is sufficient to press F2 key), then select all nodes clicking on Edit --> Select All (or Ctrl+A) and then Path --> Semplify (or Ctrl+L). You can repeat this procedure again, but make attention because the image looses quality and details.
  6. Come back in Select and transform objects modality (or press F1 key) and save all, File --> Salva as (or Maiusc+Ctrl+S). In the bottom of the appearing menu, you have to choose Desktop Cutting Plotter (AutoCAD DXF R14) (*.dxf). You may install another extension called Better DXF Output, but it was released for the previous version of Inkscape and not anymore updated.

Example

I put all the files in tiff2dxf.zip. Below some images:

From the original raster image to the two types of vector graphics
Conversion of the original image, following the two procedures described above (among parenthesis there is the threshold value) and  finally semplification of the nodes
Screen taken by LibreCAD window
Loading in LibreCAD and drawing of a simple line using snap function



Related Content:

Nicola Rainiero

A civil geotechnical engineer with the ambition to facilitate own work with free software for a knowledge and collective sharing. Also, I deal with green energy and in particular shallow geothermal energy. I have always been involved in web design and 3D modelling.

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.