From Gerber to footprint

I have a large bare pcb to assemble, with some large BGA, many small footpring QFN and 5 or 6 tssop.
… and I have the “soldermask” Gerber file.

I wish to create the real “solderpaste mask” of this board, using the gerber file as a template (the soldermask is not accurate enough to be used to generate the stencil for my solderpaste deposit)

I imagine I have to import the gerber file under pcbnew and superimpose the bga/qfn footprint comming from the kicad libs… but I imagine the procedure could be a little bit more complicated.

Did anyone ever manage to do that?
(hope so :- ))) )

Why don’t do it the other way round?

I mean, take the footprint, generate the gerber paste mask and superimpose the gerber files.

I suspect you will end up walking a long and convoluted path. You are trying to do some “reverse engineering”, but tools like KiCAD are seldom designed for that kind of task.

I don’t think there is any way to import a Gerber layer directly into PCBNew. Just thinking and speculating, I’d probably approach the problem something like:

  1. Convert the Gerber layer into a DXF drawing. Offhand, I can’t tell you which Gerber viewer can do that, but it seems like one of the many Gerber viewers should be able to do that.

  2. Create a new KiCAD project. Import the DXF of your soldermask into one of the auxilliary graphic layers of PCBNew (“Dwgs”, “Cmts”, “ECOx”, etc).

  3. Use the imported graphic as a guide for placing appropriate component footprints. You may have to spend time grubbing around in the KiCAD footprint libraries to find footprints that are closely matched to what was used to generate the soldermask Gerber.

  4. Plot a Gerber of the solderpaste layer using PCBNew.

The process will be easier if you have, or can create, a KiCAD schematic.

Good luck!


Tnks Pedro & Dale

Absolutely yes, this is a reverse engineering “by necessity”. The manufacturer of the pcb gave us the 4 “usual” gerber, but even after several inquiries, decided to ignore our request concerning the solderpaste mask.
I have approximately 5000 USD of components and 200 USD of 6 layer pcb wich are useless without this file.

So far, any gerber can be imported under PCBNew. The gerber viewer has an “export to pcbnew” option… I don’t remember if this was already the case in the 4.xx version, but it perfectly works in the 5.xx

Creating a schematic with the 5 or 8 components I need is a breeze (I just neet to make a stencil for the components which need a refusion, the remaining devices will be soldered by hand).

Superimposing the footprint on the gerber image is working without troubles. The question was “how to erase the gerber image once the footprints are in place”

I think Dale gave the right solution : pushing all the original gerber on another layer… and killing it once the job is done.

in all cases, I have created a schematic (in fact, just the main components with an empty netlist). It could also have been possible to use the “add footprint” function of pcbnew, but that’s definitely not elegant

Thanks to both of you. I think I’m close to reach my goal


1 Like

I don’t know if you want to “kill” it once you are done. Keeping it around might be valuable for documentation and any potential iterations. When exporting to gerber from your work you can choose to only export the solderpaste gerber file and not export any other layer (i.e. the documentation layer that you put your gerber import on).

EDIT: correct “soldermask” to “solderpaste”

1 Like

agreed :slight_smile: it was a rhetorical formulation… I should have said “discard” instead of “kill”.

So far, my “reverse” seems to evolve smoothly. Most of the footprint have been already placed, I still have to create 2 specific footprint (a MCL QFN package with proprietary dimensions, and a large bga package not yet include in the default kicad lib)

so far… so good
Thanks to all for your support

Euhm, wrong here.

Gerbview / File / Export to Pcbnew …

I did some experiments with this and it seemed to work well enough to be usefull, but not from perfect. A lot of info is missing in gerbers, there are no components, nor netlist.

On a small test board I was able to recover:

  • Board outline.
  • Tracks.
  • Pad locations. (All SMD pads were exported as THT pads).
  • Silk screen and other text as loose vectors.
1 Like

If you are placing all footprints, those will generate a Paste Plot, and you only need to ensure the imported info is not on the paste layer.
QFN parts may need a sparse paste pattern, which should be handled in the footprints you are placing.

That’s good news! I haven’t used GerbView, so I should probably look into this capability. And it has been there since version 4! I’m rather surprised that the “Export to PCBNew” tool could recognize a pad as a pad. Thanks for straightening me out.


The IQ of export is quite low, and does not check if the flashed pad is thru-hole.
It might be smarter if they exported pads as original shapes, and applied thru-hole only where drill was found at the same XY (or at least give users some choice, as the default is quite wrong for a SMD board)

Overall it is useful, and if you add footprints, and then import a netlist, PCBnew will auto-connect the traces, so you can reverse-build a PCB reasonably well.

I don’t think it matters much.
As long as you have the tracks (and pad locations) you can easily put standard library components on the right coordinates, and then delete the pads generated by the gerber exporter.

Having real footprints instead of loose pads is already the next step in reverse engineering.
After that you can start drawing a schematic from gueses and highliting traces.
Then import the netlist from Eeschama to Pcbnew, and keep tweaking the schematic untill there are no DRC errors and both match.

It would be usefull if the gerber exporter could guess components from relative pad location & sizes and silk screen data, but that is probably too much to ask for years to come.

In the normal PCB design flow component placement and routing are both far more time consuming than footprint assignment, and in the current state gerbview can extract both the component locations and the tracks.

Perhaps, but removing the errant thru-hole parts on a SMD import is a pain, that a simple user switch could have avoided.
Sometimes users want to import gerbers and then edit a couple of traces, and then re-plot.
The present defaults rather fight that simple flow.

Well it can extract the tracks & pad XY’s. Component location means the part placement origin, and that is not extracted.
So you need to manually line-up the pads of the library to the imported elements.

pads are enough as kicad snaps to pad centers and you can move a footprint with respect to a pad. (select the pad and then select move or start move while you are near the pad center)

1 Like

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