Add image to PCBNew for Reverse Engineering of Layout?

Hello,

Does anyone know if it’s possible to insert an image (graphic) onto the back of a PCBNew canvas? The purpose would be to take an existing gerber, and make it easier to place components in the exact spot for “reverse engineering”. Many datasheets include gerber files or images of the board. This would help me to kickstart my layout based on the evaluation modules.

Jay

Gerbview of KiCad can export to .kicad_pcb.

You can open a Gerber file in in the KiCad Gerber Viewer application and export it back to PCBNew, so if you have access to the original Gerbers this is a starting point (but you will still need footprints and a netlist).

You can import a vector graphics file into PCBnew using the import button (but it is unlikely that the image that you have is in a suitable format). Alternatively you can use this https://github.com/FabLabAQ/svg2shenzhen project to bring in data a layer at a time.

Hello,

Thank you for your replies!

The images are not in gerber, and not in vector. Imagine literally taking a picture of a board (JPG) and then trying to reverse it. Many datasheets have a gerber “image” in the PDF (not a gerber). Or again, a picture of the board. It just would make it easier to generally place components in the right spots quickly.

I checked File>Import Graphics and it expects an AutoCad DXF. Possibly if I were to convert the JPG to the DXF (embedded image file) then maybe it would open. But Adobe Illustrator won’t save as DXF. Kicad won’t open an EPS either.

I’m actually suggesting File>Import Graphics to support a JPG, GIF, or BMP. An EPS, SVG, or otherwise is probably more likely (vector). But the board layout will originate from PDF or JPG.

This might be a feature request after all! And personally, I think it would be a nice feature. Embed an image on a layer, call the layer a “graphics” layer that wouldn’t be exported to gerber. It’s just a way to quickly layout a board.

Hey, this could also help if for example another person designed a general layout idea for a board. And you could place your components where the person wanted. Or maybe if you wanted to put some LEDs around a logo or something (that was not a vector).

Jay

I already suspected you did not mean “gerber” when you wrote “gerber” because of:

Importing photographs Is a quite common feature of mechanical CAD programs. FreeCAD can do this and I’ve used it a few times for reverse engineering or just for measuring small things.
I also would like this feature to be in KiCad. The problem is that there are shitloads of Ideas for improving and extending KiCad, and still a limited amount of people working on KiCad. There are also still far more urgent issues to fill “gaps” in the functionality of KiCad, and I see this as an “extension” and not as a base feature.
With the speed KiCad is developing, I 'm hoping there will be room to implement feautes as this in a handful of years or so.
There are options to sponsor development of certain features if you want to go that way…

At the moment the best path is probably to first use filter and convert functions to get your bitmap into any kind of vector format. (.svg) is a common format. Once you have a .svg it should not be too difficult to convert do .dxf for import in KiCad.

[Edit: Oops, John already mentioned svg2shenzhen. Ah well, a few pictures don’t hurt]
For example, svg2shenzhen is a project to convert inkscape drawings ( .svg) to KiCad PCB’s.
It’s initial developmet was for artwork, but I assume it works equally well for reverse engineering.
https://duckduckgo.com/?q=svg2shenzhen&t=h_&iax=images&ia=images

This method looks promising (But I have not used it myself)

Most of the webpage is about flatbed scanner versus DSLR for making pictures. Then the photograph is converted int Photoshop to get monochrome bitmaps on layers. Then the bitmaps are imported in KiCad as Footprints.

It was one of the first results of this search:

To get from these images to a real PCB my workflow would be:

  1. Put all the components in a schematic.
  2. Assign footprints to all schematic symbols.
  3. [F8] to get all footprints in Pcbnew.
  4. Place all footprints on proper locations, draw PCB outline.
  5. Make a few connections in Eeschema.
  6. [F8] to update netlist in Pcbnew.
  7. Make those few connections in Pcbnew.
  8. Repeat from step 5 until finished.

Just trying to duplicate the PCB is probably more work then doing the schematic and the PCB at the same time. If you have the schematic, you are also far more likely to spot silly mistakes you made on the PCB. Comparing these 2 is a good sanity check.

Edit:
KiCad V5.99 has gotten the ability to load a background image in the PCB Editor. See:

Two additional ways to accomplish this task…

#1) Convert the PDF/other to a PNG using Inkscape (or other). In Inkscape, import/open the PDF and Save it as PNG.
In KiCad, Open the ‘Bitmap to Component’ editor (the Icon in toolbar).
Load the PNG and Export the file to silkscreen/other for PCB (it’s a .mod file)
Place the file where it can be accessed from your Footprint list.
Simply place a Footprint on the PCB. select the file…
Now, it’s a silkscreen and you can use the Measurement tool or just look at the cursor positions of interest.

#2) I wrote a Java app to read locations of anything on your Monitor. You’ll need a Reference dimension for correct scaling but, any known dimension can be used.
Here’s the Link to the Tool on Github. There are GIF vid’s to watch…

There is an alternative that may or not be helpful. I happen to have Coreldraw, perhaps there is a similar vector program available at no cost.
Coreldraw will easily import a JPG, tweak it to the exact size needed. You then can place “pads” where needed. Export to svg or dxf or ???.
Import into Kicad and continue to add traces.

As a workaround, I wonder how plausible this idea is:

Current layers can be specified with a transparency. Because the various options for importing are single color, is it possible to

  1. Separate RGB in picture, output each color to its own PNG.
  2. Define three new layers at the bottom of the stack.
  3. The new layers are R, G, and B respectively.
  4. Assign color (R,G,B) and appropriate transparency to each.
  5. Import each R, G, and B PNG into the corresponding layer.
  6. Full-color background image!

Some combination of GIMP script and KiCAD manipulation might be able to achieve this.

The renderer can already draw full-color bitmaps on a single layer, but this feature isn’t present in pcbnew.

Here’s the feature request: https://gitlab.com/kicad/code/kicad/-/issues/2054

I used GIMP to separate the RGB channels (Colors->Components->Decompose), changing Cmts.User, Eco1.User, and Eco2.User to RGB (respectively) and setting transparency to 33%. Importing into KiCAD reveals a problem: importing a PNG file to a layer uses a threshold, and doesn’t result in a smoothly transitioning image. Each pixel is either on or off. In the following image conversion, I may have mistaken one or more of the colors during import, but the problem is easily seen:

Original image (Edit: uploaded the correct original image):

Importing to KiCAD RGB to different layers:

Color settings (transparency to 33% for each):
image

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.