Skip to main content

img2cad

Turn a photo, sketch or engineering drawing into editable, coloured CAD — with your coding agent.

PyPI Python Tests License: MIT

Website & 3D examples · Install · Commands · Examples · How it works

A photo of an espresso cup beside the CAD model img2cad built from it, in four views

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.py opens a 3D viewer with sliders; changes rebuild locally and save back to the source.
  • 🏭 Ready to make — 3D-print check, slicer hand-off, CNC / sheet-metal DFM, engineering drawings (SVG/DXF), standard parts library, URDF 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.jpg into 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 with dimensions and a hole table
printcheck model.step watertight, overhangs, bed contact, thin walls, build volume
slice model.3mf --out x.gcode G-code via installed PrusaSlicer / SuperSlicer / OrcaSlicer / Bambu Studio
dfm model.step --process cnc|sheet CNC: sharp internal corners, tool radii, deep holes, undercuts · sheet: thickness, holes, bends
parts make screw --size M3 --length 12 ISO screws, nuts, washers, bearings, NEMA 17, 2020 extrusion
urdf model.step --out robot/ URDF + 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

Status: beta. Reviews are agent reviews (human_acceptance: not_verified); check the measured geometry and previews before you manufacture anything.

License

MIT

Metadata

Release files for img2cad 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for img2cad 0.13.0
File Size Uploaded
img2cad-0.13.0.tar.gz 380.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for img2cad 0.13.0
File Interpreter ABI Platform
img2cad-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 760.5 kB

Release files / img2cad-0.13.0.tar.gz

Download URL img2cad-0.13.0.tar.gz
Size 380.2 kB
Tags Source
SHA-256 checksum
How to use checksums
cafd5bcdaecb946f166a2c4c6911d5a7086398d02749c778f4f91e7bf2d6e8ce
BLAKE2b-256 checksum
How to use checksums
486c99e81a829efbcb3c7306500004103fe002f7f9cdfe90efd3cc72a75320ed
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

Release files / img2cad-0.13.0-py3-none-any.whl

Download URL img2cad-0.13.0-py3-none-any.whl
Size 380.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
abc572d92bcd2b4386015abb72df0e0f042361d9dfb7a16ebaa2892306965428
BLAKE2b-256 checksum
How to use checksums
331a5cbeba76345aa62b8603d7f6a98259fa2c591d9e0bd516f0398d76a20ac3
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

Release history Release notifications | RSS feed

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

This release

0.13.0 This release

2 release files

0.12.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page