Introduction: Vectorize Images for Laser Cutting and 3D Printing

About: Most of the things I build usually relate to either astronomy, physics or woodworking in general.

Just before Christmas, I decided to make tree ornaments for my family and friends. The idea was to CNC or laser cut them in a 1/8" plywood sheet. My first task was to find a nice model online. There was quite a few that I liked but I could not find a vector file that I could run directly on the laser cutter, so I decided to vectorize a JPEG image into an SVG file.

After some research, I found a nice little program that does exactly that. Potrace by Peter Selinger is a tiny (<1MB) but powerful open source software that take a bitmap as a source and converts it to various formats such as SVG, EPS, Postscript, PDF, DXF, etc.

In this Instructable, I will show you how to convert your images into vector files without the use for any commercial software such as Photoshop, Corel Draw or Illustrator. You will then be able to modify or use this file directly on a laser cutter, a CNC or a 3D printer.

Step 1: Download Potrace

Potrace has many qualities such as:

  • Open source software
  • Really small size (<1MB)
  • Works on Windows, Mac, Linux and a lot more platforms
  • Does not need to be installed which means you can save all distributions on a flash drive and copy the right one on any computer

Head to http://potrace.sourceforge.net/ to download the latest version of Potrace. The file will come as an archive so you'll need to extract it on your computer. It can be extracted anywhere so you can leave it in your download directory if you want.

Please note that Linux users can install potrace from their package manager. For example, Ubuntu users can install potrace by typing "sudo apt-get install potrace".

If for any reason, you can't run the program on your computer, you can still download earlier versions of the application here: http://potrace.sourceforge.net/download/. For example, my Mac 10.6.8 is getting old and could not launch version 1.12 so I installed version 1.11 which works fine.

Step 2: Locate Potrace on Your Computer

Once you have extracted Potrace, you will need to open a console and navigate to the executable file. Here's how to do it on different platforms:

Step 1: Open the console

Windows: Click on the Start button, All Programs, then Accessories, and then click on Command Prompt.

Linux: Each distribution comes with its default console. On Ubuntu, it's probably called "Terminal".

Mac: The program is called Terminal. You can search for it using spotlight or navigate to it using Finder (Go -> Application -> Utilities -> Terminal).

Step 2: Navigate to the program

(You can skip this step if you installed the program using your linux package manager.)

Now that you have opened a console/Terminal, you need to navigate to where you extracted the program. Let's say that you extracted it in your download directory, here's what you need to type in the console:

Windows XP: cd C:\Documents and Settings\username\My Documents\Downloads\potrace-1.12.win64

Windows vista and up: cd Downloads\potrace-1.12.win64

Linux: cd ~/Downloads/potrace-1.12.linux-x86_64

Mac: cd ~/Downloads/potrace-1.12.mac-i386

Remember, you will need to adapt this example to the path where you extracted potrace and the version of potrace you just downloaded. Also, use 32 instead of 64 if your system is 32 bits.

Step 3: Prepare Your Source File

Now that you've done the hardest part, you'll need to prepare the image that you want to vectorize.

Open your image with the default image editor installed on your computer (preview, image viewer, paint, gimp, etc) and save it as a bitmap (BMP extension). Each software has a different interface but you should figure it out easily. Paint has a "Save as" menu item while Gimp has an "Export as" menu entry.

When you have successfully created your BMP file, you're ready for the next step.

Step 4: Vectorize Your Bitmap File

If you've reached that step, that means you should have a bitmap file of your original image and the console open at the right location.

You can now use potrace to vectorize your image. Here's the syntax I generally use:

Windows: potrace.exe path-to-my-file/my-file.bmp -s -o my-file.svg

Mac: ./potrace path-to-my-file/my-file.bmp -s -o my-file.svg

Linux: ./potrace path-to-my-file/my-file.bmp -s -o my-file.svg

Linux with potrace installed through package manager: potrace path-to-my-file/my-file.bmp -s -o my-file.svg

-s stands for SVG

-o stands for Output file name

You will find all the available options on the home page of the program: http://potrace.sourceforge.net/#usage.

You should now find an SVG file in your potrace directory. It is a vector file and it can be imported in Corel Draw or other laser cutting and 3D printing software.

Step 5: Going Further With Potrace

Another great advantage of Potrace is that you can create a script to vectorize all your images at once:


This is the script I used on my linux computer but it should work on Mac too:

for image in ../sample-images/*.bmp; do ./potrace $image -s --progress -o $image.svg; done

This would be the script for Windows users:

for %f in (..\sample-images\*.bmp) do potrace %f -s --progress -o %f.svg

You will need to adapt the path to your directory structure. What this script does is looking for any BMP image in a certain folder (../sample-images in my case) and running potrace on each of them. The --progress option gives you a nice progress bar output. The beauty of it is that it took less than a second to convert them all.

Step 6: Conclusion

Potrace is a convenient free tool to convert images into vector files. The fact that you need to run a program in a console usually drives people away. If that's the case for you, be aware that there are some graphical interfaces for potrace with their own specific features available for Windows, Mac and Linux (http://potrace.sourceforge.net/#other). There are also a few websites doing this vectorization process in the cloud. However, I am not covering this part because I wanted this Instructable to be a general guide usable by everyone on every computer, without the need for an internet connection.

Here's a fun way to try it out:

Make a drawing with a sharpie, take a picture of it, run it through potrace and laser cut it.