KeyForge3D

KeyForge3D

Photo-to-STL key modeling tool

Description

Copying a key means a special trip to the locksmith, and there's no easy way to keep a backup of an old house key before it's lost. KeyForge3D takes a different route: photograph a key and it reconstructs the cut pattern into a 3D-printable STL. It uses OpenCV to analyze the key's outline in the photo, reads out the bitting code automatically (e.g. "05624"), then builds a dimensionally accurate 3D model with Trimesh and exports an STL you print in Cura or PrusaSlicer.

It ships with a Tkinter GUI — upload an image, process with one click, export the model, all by mouse — handy for locksmiths and hobbyists alike. Results are best with the key flat on white paper under even lighting, and a coin in frame lets you calibrate to real-world scale. Please note: tools like this should only be used to duplicate keys you own or have explicit permission from the owner to copy; reproducing someone else's key without authorization is illegal in most jurisdictions, and this project is listed for the legitimate purposes of locksmithing, security research and learning 3D printing.

Features



Key profile extraction: Upload a photo of a key and image processing pulls out its 2D silhouette as the basis for modeling.

Automatic bitting analysis: Detects and reads the key's bitting depth code (e.g. 05624), no measuring each cut by caliper.

3D model generation: Extrudes the 2D profile into a model with accurate cuts and thickness at real dimensions — default 1 pixel = 0.1mm, calibratable with a reference object.

STL export: Exports an STL directly; print in a rigid material like PLA or ABS at a 0.1mm layer height so the bitting cuts stay precise.

GUI workflow: The Tkinter interface strings upload, processing and export into one flow — no command line needed.

Open-source stack: Built on OpenCV, NumPy, Trimesh, Shapely and Pillow under the MIT license, so the code is readable and modifiable.