Customers often ask us for a gate or sheet metal with a specific shape or design cut by laser or plasma. In other cases, to make a gift or a sign, we would like to transform a photo into a cut sheet with a particular silhouette. To do this we have to convert a jpg file to dxf format compatible with sheet metal cutting machines. Let’s find out how to do it with easy and free tools.
First of all we have to start from an image where the subject is sufficiently defined, without shadows or nuances. The subject must also have a minimum of contrast from the background.
Let’s take as an example this image of a seagull: it is sharp, separated from the background, and has no shadows. In this guide we will refer to two open and free programs:
GIMP (for photo editing) and Inkscape (for vector graphics). They can almost completely replace their expensive counterparts Adobe Photoshop® and Adobe Illustrator®. The tools and procedures are similar for both software.
Let’s open the image with GIMP. For your convenience, it is preferable that the subject is darker than the background. If not, use the Invert function from the Color menu. Then turn the photograph into a two-color image with the Threshold tool in the Color menu. Let’s move the cursor until we find the value that generates the best result.
Now let’s use the Fuzzy Selection tool, also known as the Magic Wand, from the panel. It allows us to select a part of the image automatically according to the color. We click on the seagull to select it automatically. If the subject is composed of separate parts, we can add them by clicking while holding down the Shift key.
Delete the rest of the photo with Select > Invert selection and press the Delete button. Only our beautiful seagull will remain on a white background. We can save the photo in PNG format from the menu File > Export. It is better to avoid the JPG format because it generates a lot of “noise” in the photo and can cause problems in the next steps.
If the subject is not sufficiently isolated from the rest of the image, we will have to cut it out by hand to obtain a separate figure. If it is only one object, we can do it with the tool Freehand Selection: we click a little at a time around the subject until we close the selection perimeter. It takes patience and a steady hand: the closer the points are, the more precise the result will be. Then we invert the selection and delete the rest of the image as we have already seen. We make the selection pure black with the Threshold tool and export the image to PNG.
For subjects made up of several separate parts, it gets a little more complicated. To avoid complicating our lives, we can use the Eraser tool to “separate” the subject from the background, erasing everything around the perimeter. We set the Eraser tool with a small area, about 3 pixels. We disable the shadings and dynamics of the pressure, so that the erasure is sharp and defined. We do this for all the borders, then we delete the rest of the image quickly with the Eraser tool (increasing the area of the stroke to do it faster). We can also select the various subjects to be saved with the Fuzzy Selection tool and the Shift key as described earlier, reverse the selection and delete the rest of the image. Let’s do the usual steps of Threshold and Export function and proceed to the next process.
It’s time to deploy our second weapon: Inkscape! Launch the program and add the PNG file from the menu File > Import. The image is still in raster format, which means it is not a line but a dot matrix. To turn it into a DXF path we first have to transform it into a vector path, i.e. a series of mathematical curves. The advantage of vector images over bitmap images is that we can enlarge them at will without loss of quality. In addition, their size is almost always much lower than the corresponding raster file.
To transform the photo into a path, let’s select it and go to Path > Trace bitmap. The settings in the Mode tab are usually sufficient, especially as we have already transformed our color photo into a black and white image. In the Options tab we also find the Smooth Corners function, useful to make the edges of our subject less rough and squared. Here, too, the value you find is usually a good starting point.
Click OK to launch the conversion and return to the main window. We will find a shape with smooth and sharp contours: if the path was generated correctly, we can select the initial image and delete it. Select the path and click on the padlock to lock the height/width ratio and avoid deformations. Then we select the mm unit of measure and if necessary we bring the image to the required size. In any case, we can modify the dimensions of the drawing at a later date with the most common CAD programs.
If we wanted to modify this image, we can retouch it using the Edit Paths tool, and then dragging the nodes that make up the figure. Once the changes have been completed, we export the file to DXF from the File > Save As menu and select the Desktop Cutting Plotter format, and if necessary modify the available options. Finished!
Of course there are many other functions to work with vector images: Inkscape is a complete and powerful program to create drawings from scratch or edit existing files. I leave to you the possibility to discover it and use it to create real works of art made of sheet metal.
This pair of programs allows in a few steps the maximum control over the conversion and modification of files, to obtain dxf files ready for laser cutting starting from less than ideal images. There are also online services that can transform a photo into a vector file, with very variable results and often restrictions on the amount of raster images that you can convert to dxf.