img2cad
Turn a photo, sketch or engineering drawing into editable, coloured CAD — with your coding agent.
Website & 3D examples · Install · Commands · Examples · How it works
img2cad gives Claude Code, Codex, Cursor, Gemini CLI or any MCP host a staged, checked workflow for image → CAD. The agent reads the image, records what it sees and plans the parts, writes build123d source, and the local runner builds it, measures it, and overlays it on the image — refusing to move on until geometry, dimensions and a visual review pass.
You get a parametric model.py you can keep editing, plus STEP (named, coloured parts), GLB, STL and 3MF.
Highlights
- 🧭 Agent workflow, not a one-shot guess — observe → plan → build → compare → revise, with hash-bound gates and resumable revisions.
- 📐 Real dimensions — fit the photo's camera to known features (
img2cad camera), register the model on the image, trace outlines in millimetres. - 📷 Any input — product photos, several photos from any angle (visual hull from fitted cameras), hand sketches, dimensioned drawings.
- ✂️ Masks in one click — colour seeds, polygons, or optional SAM 2 segmentation.
- 🎛️ Live parameter panel —
img2cad view model.pyopens a 3D viewer with sliders; changes rebuild locally and save back to the source. - 🏭 Ready to make — 3D-print check, slicing and sending to your printer, CNC / sheet-metal DFM with flat blanks, engineering drawings (SVG/DXF/PDF), a standard parts library, URDF / SDF / MJCF for robots.
Install
In your agent
| Host | Install |
|---|---|
| Claude Code | /plugin marketplace add YUI-TIEN/img2cad then /plugin install img2cad@img2cad |
| Gemini CLI | gemini extensions install https://github.com/YUI-TIEN/img2cad |
| Codex / Cursor | add this repository as a plugin (.codex-plugin/, .cursor-plugin/) |
| Any agent with skills | npx skills add YUI-TIEN/img2cad |
| Any MCP host | command uvx img2cad mcp (see below) |
MCP server config (Claude Desktop, Cursor, VS Code, …)
{
"mcpServers": {
"img2cad": { "command": "uvx", "args": ["--python", "3.13", "img2cad", "mcp"] }
}
}
Command line
pip install img2cad # or: uv tool install img2cad
img2cad doctor # checks the CAD stack (build123d / OCP)
uvx img2cad doctor # run without installing
pip install "img2cad[sam]" # optional: SAM 2 segmentation for `img2cad mask --sam`
Python 3.10–3.13. Latest from GitHub: pip install git+https://github.com/YUI-TIEN/img2cad.
From a clone (contributors)
git clone https://github.com/YUI-TIEN/img2cad && cd img2cad
python3 -m venv .venv-cad && .venv-cad/bin/pip install -r requirements-cad.lock -e .
.venv-cad/bin/img2cad doctor
Quick start
Give your agent an image and ask:
Turn
mug.jpginto editable CAD. It is 95 mm tall. Use img2cad.
The agent follows skills/img2cad/SKILL.md: it runs img2cad workflow init, records observations and a part plan, writes model.py, builds it, compares it with the photo, and revises until the review passes. Open the result:
img2cad view runs/mug/model.py # 3D viewer + parameter sliders
Commands
| Command | What it does |
|---|---|
workflow |
staged, resumable image → CAD workflow (init, observations, plan, run, review, new-revision, promote, status) |
build model.py out/ |
STEP + GLB/STL/3MF, checks, previews, comparison and registered overlay |
camera camera.json |
fit the photo's camera to known circles/points; refuses poor fits |
mask photo.png mask.png |
subject mask from polygons, ellipses, colour seeds or --sam |
hull views.json |
blockout from 2+ silhouettes — front/right/top or photos at any angle |
trace image.png |
colour regions → pixel outlines |
inspect model.step |
validity, parts, colours, bounds, volume, holes |
view · params |
3D viewer with live parameters · list/set parameters |
export model.step out/ |
GLB (coloured), 3MF (coloured parts), STL |
drawing model.step out/ |
three-view SVG/DXF/PDF: overall dimensions, tagged holes/bosses with baseline position dimensions, hole table |
printcheck model.step [--orient] |
watertight, overhangs, bed contact, thin walls, build volume; --orient picks the orientation needing the least support |
slice model.3mf --out x.gcode |
G-code via installed PrusaSlicer / SuperSlicer / OrcaSlicer / Bambu Studio |
send x.gcode --printer octoprint --host … |
upload to OctoPrint, PrusaLink, Moonraker (Klipper) or Bambu LAN; --start prints |
dfm model.step --process cnc|sheet |
CNC: sharp internal corners, tool radii, deep holes, setups · sheet: thickness, hole-to-bend, bends, flat blank |
parts make screw --size M3 --length 12 |
ISO screws (real threads with --threads), nuts, washers, bearings, spur gears, GT2 pulleys, MGN rails, servos, NEMA 17, 2020 extrusion |
urdf model.step --out robot/ |
URDF, SDF or MuJoCo MJCF + meshes with joints and exact mass/inertia |
mcp · doctor · version |
MCP server (stdio) · environment check · version |
img2cad <command> --help shows every option. Full CLI reference: docs/WORKFLOW.md.
Examples
| Input | Technique | |
|---|---|---|
| espresso-cup | real photo | camera fitted to three circles, profile from silhouette edges |
| falcon9-pad | real photo (NASA) | known dimensions as scale, lattice towers |
| mounting-plate | dimensioned drawing | fillets, hole patterns, dimension gates |
| flanged-bushing | drawing | half-profile revolve |
| vase · fish · standing-horse · pagoda | sketches | splines, lofts, limbs, roofs, projected paint |
Each one keeps the whole chain — reference, observations, plan, model.py, comparison and review. Browse them in 3D on the website.
How it compares
Text-to-CAD tools start from words; mesh generators give you triangles. img2cad starts from your image and ends at editable B-rep source with measured checks — a workflow your agent runs, not a hosted model. See docs/DESIGN.md for the design and related projects.
Documentation
- docs/DESIGN.md — problem, design principles, acceptance criteria
- docs/WORKFLOW.md — workflow CLI reference and learning material
- skills/img2cad/SKILL.md — the agent contract · MODELING.md · LESSONS.md
- skills/cad-output/SKILL.md — drawings, printing, DFM, parts, robots
- benchmark/ · CHANGELOG · ROADMAP · CONTRIBUTING · SECURITY
Status: beta. Reviews are agent reviews (
human_acceptance: not_verified); check the measured geometry and previews before you manufacture anything.
License
Metadata
Release files for img2cad 0.15.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| img2cad-0.15.0.tar.gz | 396.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| img2cad-0.15.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 790.8 kB
Release files / img2cad-0.15.0.tar.gz
| Download URL | img2cad-0.15.0.tar.gz |
|---|---|
| Size | 396.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e9001494d8d23ecba6f9accbe913146bef2cd28385cf31845d79f11d9063709
|
|
BLAKE2b-256 checksum How to use checksums |
0fdce6c2a8f35ef4abc4ec20199a8341db6390895da113e717de775077758b33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / img2cad-0.15.0-py3-none-any.whl
| Download URL | img2cad-0.15.0-py3-none-any.whl |
|---|---|
| Size | 394.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11a8389cd557b992192d9b2e8c8b7dcfd7053d72675bc36c096426ad00abfae0
|
|
BLAKE2b-256 checksum How to use checksums |
a60770f557d054f01c175899fdf42189f932a86d9296eb26c68ba96480ed550c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log