Importing Custom Images into Eagle a learn.sparkfun.com tutorial

Available online at: http://sfe.io/t606

Contents

Introduction

Creating custom artwork on your PCB can be a fun way to personalize your project, add a company logo, or go crazy with pin numbering fonts. In this tutorial, we'll show you 3 different methods of importing custom images into Eagle. Note that each of the three ways has pros and cons.

Badger custom art on PCB in Eagle

We used Method #1 to import this badger face as a series of polygons in Eagle

We recommend trying Method #1 (SVG to Polygon) first. It is the most complicated, but, if it works, you'll have a set of polygons for your custom image that are much easier to work with than the lines/rectangles created by methods 2 and 3. If that fails, try method 2 or 3 to import an image as a series of lines, but be warned that having that many shapes can slow down your computer.

Additionally, you can import an image with method 2 or 3 and then trace over them with polygons in Eagle.

Recommended Reading

Before starting with this tutorial, we recommend that you be familiar with the basics of Eagle CAD:

Method 1: SVG to Polygon

Importing a vector graphic directly into Eagle requires a bit of work, but we recommend trying it first because:

Note: This method requires Inkscape to work.

Download Inkscape

If you don't already have it, download and install the latest version of Inkscape. You will need it for this method.

Draw or Import Image

Draw, download, import, etc. your desired image. Make sure it is a single color (we'll use black) and saved as a vector graphic (e.g. SVG). In this example, we'll import an SVG image made with Adobe Illustrator.

Note: If your original image is a bitmap, you can also use Inkscape's bitmap tracing tool to make a vector graphic.

Change Image to Standard Size

Click the select tool (F1), and select Edit > Select All in All Layers (Ctrl + Alt + a).

alt text

Click the button to lock the height/width ratio.

alt text

Change the units to mm, and change height to 100.

alt text

Go to File > Document Properties..., select Resize page to content... drop down, and click Resize page to drawing or selection.

alt text

Massage Nodes

Convert the object to a path and select nodes:

alt text

Add interpolated nodes and flatten beziers (we want straight lines for the polygon):

alt text

Cut Closed Loops

Any shapes that have a closed loop or a "hole," will need to be cut (Eagle doesn't know how to create a polygon with a hole in it).

Draw a shape, such as a rectangle, that divides the hole.

alt text

Hold Shift, and select both the rectangle and your image. Select Path > Division (Ctrl + /). Repeat this process for any closed loops in your image, such as donuts, outlines, and letters like 'o' and 'd'. You should end up with a number of paths that make up your image.

alt text

Select all nodes with the path editor tool (F2, Ctrl + a). Click Path > Break Apart (Shift + Ctrl + k).

alt text

Export as Plain SVG

Click File > Save As, give your exported SVG file a name (make sure you include the .svg suffix!), and select Plain SVG (*.svg) from the Save as type: drop-down menu. Click Save.

alt text

Import SVG as Polygon in Eagle

Download the Eagle-ULPs repository as ZIP. Unzip the directory, and copy the file svg2poly.ulp to the [EAGLE Directory]/ulp directory.

alt text

Start Eagle, and either create a new footprint or open your layout where you want to import the graphic.

If you want to put the image at a particular point, enter the command:

mark

and click where you want the center of the image to appear. Then, run the command (you can change the ratio to whatever you want to scale the image appropriately):

run svg2poly -ratio 0.001

Select your plain SVG image, and it should be drawn on the tDocu layer. If the image does not show up properly, see the Troubleshooting section below.

Import SVG to Eagle custom image

Since these are polygons, you can modify and tweak them as needed to meet your PCB needs. Also, you can change the layer to something else, like tPlace to make it appear in the top silk!

Change Polygon Width

Improtant! You need to perform this step if you plan to create Gerber files for your board, otherwise, you might get an error message that says: some element contains a polygon that may cause extremely large plot data and your CAM job will take a really long time (e.g. hours).

Right-click on each polygon section of your image in Eagle, select Properties, and change the Width to something larger than 0 (e.g. 0.001). Keep in mind that this will make your polygons slightly larger around the edges. Make sure you do this to every section in the image!

alt text

Troubleshooting

If your image does not import correctly (it often doesn't), there are a few tricks you can do to make it work.

alt text

First, figure out which sections of the image are not importing correctly, and divide them up more using the Cut Closed Loops method above. You can also try cutting closed loops in different ways. Make sure you select all nodes (F2, Ctrl + a) and Path > Break Apart (Shfit + Ctrl + k) before saving as a Plain SVG.

alt text

If certain sections are proving to be problematic, you can try deleting some of the nodes to see if that helps. If you delete nodes, you will need to select nodes in that section (F2) and Extensions > Modify Path > Flatten beziers. You then need to reselect all nodes in the image (F2, Ctrl + a) and Path > Break Apart (Shfit + Ctrl + k) before saving as a Plain SVG.

alt text

If all that fails, you can try manually drawing a new section in Inkscape. Don't forget to Add Nodes, Flatten Beziers, and Break Apart before saving the new image.

alt text

Method 2: Import DXF

AutoCAD developed the Data Exchange Format (.DXF) to allow for sharing of files between AutoCAD and other programs. Lucky for us, newer versions of Eagle (7.7.0+) can also import DXF files. We can use that to add custom artwork to a layer.

Note: We'll be using Inkscape to prepare the DXF for importing. Also, note that this method results in an outline of the shape, not a complete fill.

Download Inkscape

If you don't already have it, download and install the latest version of Inkscape. You will need it for this method.

Draw or Import Image

Draw, download, import, etc. your desired image. Make sure it is a single color (we'll use black) and saved as a vector graphic (e.g. SVG). In this example, we'll import an image made with Adobe Illustrator and saved as an SVG.

Note: If your original image is a bitmap, you can also use Inkscape's bitmap tracing tool to make a vector graphic.

Change Image to Standard Size

Click the select tool (F1), and select Edit > Select All in All Layers (Ctrl + Alt + a).

alt text

Click the button to lock the height/width ratio.

alt text

Change the units to mm, and change height to 100.

alt text

Go to File > Document Properties..., select Resize page to content... drop down, and click Resize page to drawing or selection.

alt text

Massage Nodes

Convert the object to a path and select nodes:

alt text

Add interpolated nodes and flatten beziers (we want straight lines for the polygon):

alt text

Cut Closed Loops

Any shapes that have a closed loop or a "hole," you'll need to cut them (Eagle doesn't know how to create a polygon with a hole in it).

Draw a shape, such as a rectangle, that divides the hole.

alt text

Hold Shift, and select both the rectangle and your image. Select Path > Division (Ctrl + /). Repeat this process for any closed loops in your image, such as donuts, outlines, and letters like 'o' and 'd'. You should end up with a number of paths that make up your image.

alt text

Select all nodes with the path editor tool (F2, Ctrl + a). Click Path > Break Apart (Shift + Ctrl + k).

alt text

Export as DXF

Click File > Save As, give your file a name (make sure to include the .dxf extension!), and select Desktop Cutting Plotter (R13) (*.dxf) from the Save as type: drop-down menu. Click Save.

alt text

Make sure use LWPOLYLINE type of output is selected, and click OK.

alt text

Import DXF in Eagle

Start Eagle, and either create a new footprint or open your layout where you want to import the graphic.

Enter the command

run import-dxf

Click Browse to select your DXF file. Select the target layer, and change the scale as desired.

alt text

Click OK and Run on the pop-up window to import the image. Because the outline is made of lines, you can delete, move, and add lines as needed.

alt text

Method 3: Import BMP

Importing a bitmap into Eagle is probably the easiest method, but the import process draws many rectangles on a separate layer, which can be difficult to modify. It is recommended that you use bitmaps as a template to draw lines or polygons in Eagle.

Warning: Importing bitmaps can slow down computers when preparing Gerbers or panelizing.

Create a Bitmap

Use your favorite drawing program to create a monochrome (black and white) image.

alt text

Save the image as a Monochrome bitmap.

alt text

Import Bitmap

Start Eagle, and either create a new footprint or open your layout where you want to import the graphic.

Run the command:

run import-bmp

Read the pop-up window warning, and click OK. Select your bitmap file, and click Open. Select the black color to be imported, and click OK.

alt text

Scale your image as necessary, and select the desired units (I kept "mil" for this example).

alt text

Click OK and Run script on the pop-up. Your image should be imported on the "200 200bmp" layer as a series of rectangles.

alt text

If you zoom in on the imported image, you'll see that it is actually made up of a series of rectangle shapes. These can slow down your computer and be a pain to work with if you need to make changes in Eagle, but it is a simple and effective way to get an image into Eagle.

alt text

Resources and Going Further

Try playing with some of the layers in Eagle to make interesting effects in your artwork! For example, in the badger face from the Introduction, the face is on the tPlace (top silk) layer, but the eyes are on the Top (top copper) layer. When the boards are produced, the face is white, but the eyes come out silver, copper, or gold colored (depending on the finish used).

alt text

Resources

Check out these other resources to aid in graphic design on your PCBs.

Going Further

Want to share your custom artwork with others? Check out these tutorials on how to contribute to and make your own public GitHub repositories. What more advanced Eagle tips and Tricks? Learn how to take your design to the next levels with these other great SparkFun Eagle tutorials.

Using GitHub

How to use repositories and GitHub for version control.

Using GitHub to Share with SparkFun

A simple step-by-step tutorial to help you download files from SparkFun's GitHub site, make changes, and share the changes with SparkFun.

Constant Innovation in Quality Control

In this article, we share our recent advancements in quality control. Along with making our tests more thorough, we have also made them more efficient and robust.

Making Custom Footprints in EAGLE

This tutorial will show you how to make custom, 1:1 footprint for any IC in EAGLE.

Or check out these blog posts for ideas when using negative silkscreen and custom utilities.

Engineer Thursday - Artistic PCBs in Eagle

June 13, 2013

Making Pretty Silkscreen with Buzzard

February 14, 2018

learn.sparkfun.com | CC BY-SA 3.0 | SparkFun Electronics | Niwot, Colorado