
Train relay
johnbetts/kicad-image-gen
creates 2d and 3d kicad PCB images for agentic review

creates 2d and 3d kicad PCB images for agentic review
Train power is an open-source printed circuit board by johnbetts, from the johnbetts/kicad-image-gen repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board of 50 × 40 mm with 19 parts on 9 nets.
It is built around the TPS54331D, AMS1117-3.3 and SS14. Its parts include 6 capacitors, 3 connectors, 2 resistors, 2 ICs and 1 diode.
Generate PNG screenshots of KiCad PCBs that look like the PCB editor -- headlessly, from the command line or Python.
I was designing PCBs with an AI-assisted workflow (kicad-ai-workflow) and hit a wall: every time I wanted Claude to review a board layout, I had to manually screenshot the KiCad PCB editor and paste the image into the conversation. Over and over. For every iteration.
I tried kicad-cli exports, but the raw SVG/PDF output looked nothing like the editor -- wrong colors, no ratsnest, no pad labels, missing mounting holes. The images were useless for AI-driven layout review because they didn't show the information an EE needs to evaluate placement: which pads connect where, what's routed, what isn't.
So I built this tool. It generates images that match the KiCad PCB editor appearance -- dark navy background, red pads, cyan mounting holes, visible ratsnest lines, pad numbers and net names -- using a custom color theme, SVG post-processing, and careful layer ordering.
Now my workflow is fully automated: generate a board, render images, feed them to Claude for review, apply fixes, re-render, repeat. The whole loop runs inside autoresearch iterations -- modify placement, render, score, keep or discard -- without ever opening KiCad.
kicad-cli under the hood)brew install librsvgpip install -e .
# Install the custom KiCad color theme (required for editor-matching colors)
cp kicad_image_gen_theme.json ~/Library/Preferences/kicad/10.0/colors/kicad_image_gen.json# 2D editor-style screenshot (with ratsnest + pad labels)
kicad-image-gen 2d board.kicad_pcb -o board_2d.png
# Composite mode (3D render base + overlay -- photorealistic)
kicad-image-gen 2d --composite board.kicad_pcb -o board_composite.png
# 3D rendered view
kicad-image-gen 3d board.kicad_pcb --view iso -q high --floor -o board_3d.png
# Full set: 2D top/bottom + 3D top/bottom/iso
kicad-image-gen both board.kicad_pcb -o output_dir/| Flag | Description |
|---|---|
-l, --layers | Layer list or preset: all, top, bottom, copper, silkscreen, fab |
-w, --width | Output width in pixels (default: 4800) |
-t, --theme | KiCad color theme name (default: kicad_image_gen) |
--composite | Use 3D renderer as base with PIL overlays |
--no-ratsnest | Hide ratsnest lines |
--no-pad-labels | Hide pad numbers and net names |
--pad-labels | Show pad numbers and net names (default) |
-m, --mirror | Mirror the board |
--bw | Black and white |
| Flag | Description |
|---|---|
--view | Preset: top, bottom, iso, iso-back, iso-bottom, front, back, left, right |
-w, --width | Image width (default: 1600) |
--height | Image height (default: 900) |
-q, --quality | basic or high |
--perspective | Perspective projection |
--floor | Enable floor, shadows, post-processing |
--zoom | Camera zoom level |
--rotate | Custom rotation as X,Y,Z degrees |
from kicad_image_gen import render_2d, render_3d, render_2d_composite, render_all
# 2D editor view with ratsnest and pad labels
render_2d("board.kicad_pcb", "board_2d.png", width=4800)
# 2D clean (no overlays)
render_2d("board.kicad_pcb", "board_clean.png", ratsnest=False, pad_labels=False)
# 3D isometric
render_3d("board.kicad_pcb", "board_3d.png", view="iso", quality="high", floor=True)
# Composite (photorealistic base + ratsnest overlay)
render_2d_composite("board.kicad_pcb", "board_composite.png", ratsnest=True)
# Full set: 2d_top, 2d_bottom, 3d_top, 3d_bottom, 3d_iso
results = render_all("board.kicad_pcb", "output/")The 2D output matches the KiCad PCB editor appearance:
Thin wrapper around kicad-cli (KiCad 10's official CLI). No dependency on the deprecated pcbnew Python bindings.
kicad-cli pcb export svg with custom theme and layer ordering -> SVG post-processing (background, mounting holes, ratsnest, pad labels) -> rsvg-convert -> PNGkicad-cli pcb render -> PNG (direct output)kicad-cli pcb render --side top -> Pillow overlay compositing.kicad_pcb S-expression regex parser for pads, nets, bounds, mounting holesThis tool was built specifically for AI-driven PCB design loops. Other Claude Code skills can call it directly:
from kicad_image_gen import render_2d
render_2d(pcb_path, output_path)Or via CLI in any agent's bash:
kicad-image-gen 2d board.kicad_pcb -o placement.pngApache 2.0
| Qty | Value | Footprint | References |
|---|---|---|---|
| 4 | MountingHole | MountingHole:MountingHole_2.7mm_M2.5 | H1, H2, H3, H4 |
| 2 | 100nF | easyeda2kicad:C0805 | C3, C6 |
| 2 | 10uF | easyeda2kicad:C0805 | C1, C4 |
| 2 | 22uF | Capacitor_SMD:C_0805_2012Metric | C2, C5 |
| 2 | Pin_Header_2P | easyeda2kicad:HDR-TH_2P-P2.54-V-M-1 | J2, J3 |
| 1 | 100K | easyeda2kicad:R0805 | R1 |
| 1 | 10uH | Inductor_SMD:L_1210 | L1 |
| 1 | 33K | easyeda2kicad:R0805 | R2 |
| 1 | AMS1117-3.3 | easyeda2kicad:SOT-223-3_L6.5-W3.4-P2.30-LS7.0-BR | U2 |
| 1 | SS14 | easyeda2kicad:SOD-323_L1.8-W1.3-LS2.5-RD | D1 |
| 1 | Screw_Terminal_2P | easyeda2kicad:CONN-TH_2P-P5.00_WJ128V-5.0-2P | J1 |
| 1 | TPS54331 | easyeda2kicad:SOIC-8_L5.0-W4.0-P1.27-LS6.0-BL | U1 |

johnbetts/kicad-image-gen
creates 2d and 3d kicad PCB images for agentic review

johnbetts/kicad-image-gen
creates 2d and 3d kicad PCB images for agentic review

johnbetts/kicad-image-gen
creates 2d and 3d kicad PCB images for agentic review

johnbetts/kicad-image-gen
creates 2d and 3d kicad PCB images for agentic review

phonght32/OpenDrone_HW_Transmitter_F103
OpenDrone Project - Transmitter hardware using STM32F103.


ucw-gadgets/ventilation-control
Board for controlling ventilation system


Chrismettal/ESP-Hiro
ESP-8266 Smart home dev board / general purpose IO for your home!

punkfab/pcb-corpus
235 real KiCad boards from open-source hardware repositories, prepared as a placement and routing benchmark


bluedot-arcade/bd845-pwb-board
A clone of the original Konami GN845-PWB(B) Stage I/O board for DDR machines.
It measures 50 × 40 mm and has 2 copper layers, 1.6 mm thick.
19 parts, built around the TPS54331D, AMS1117-3.3 and SS14. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the johnbetts/kicad-image-gen repository on GitHub, at the commit this page was made from: the board is reference/train_power.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the Apache-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).