Transform any image into physical string art with numbered nail positions and step-by-step routing instructions.
- Physical canvas dimensions — enter your actual canvas size in cm or inches
- Smart nail spacing — set spacing in mm (5-30mm), automatically calculates nail count
- Spacing quality indicator — shows if spacing is optimal, tight, or relaxed
- Recommended presets — quick buttons for recommended, high-detail, or easy spacing
- Upload any image — automatically converts to grayscale for processing
- Real-time preview — watch the string art build with playback controls
- Nail overlay — numbered positions starting from top-left, going clockwise
- Export options:
- Step-by-step routing instructions with nail counts per edge (TXT)
- Printable nail overlay template with dimensions (PNG)
| Spacing | Quality | Description |
|---|---|---|
| 5-6mm | Very Tight | Maximum detail, difficult to work with |
| 6-8mm | Tight | High detail, challenging |
| 8-12mm | Optimal | Best balance of detail and workability |
| 12-18mm | Relaxed | Easier to work with, less detail |
| 18-30mm | Sparse | Quick projects, minimal detail |
The algorithm uses a greedy approach:
- Places numbered nails evenly around the canvas perimeter
- Converts the image to grayscale (dark = more string needed)
- Starting at nail 0, finds which nail connection creates the darkest line
- "Subtracts" that line from the image and repeats
- Outputs the complete routing path
npm install
npm run devIf you're on Windows using WSL, follow these steps for a clean virtual environment setup:
# Install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# Reload shell config
source ~/.bashrc
# Install latest LTS Node.js
nvm install --lts
# Verify installation
node --version
npm --version# Clone the repo (or unzip if you downloaded it)
cd ~
git clone https://github.com/YOUR_USERNAME/string-art-generator.git
cd string-art-generator
# Install dependencies in isolated node_modules
npm installnpm run devThis starts Vite on http://localhost:5173. Open this URL in your Windows browser.
WSL2 automatically forwards ports, so just open:
http://localhost:5173
If that doesn't work, find your WSL IP:
ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'Then open http://<WSL_IP>:5173 in Windows.
# Create optimized build
npm run build
# Preview production build locally
npm run previewThe built files will be in the dist/ folder, ready to deploy anywhere.
If you work on multiple projects, you can lock this project to a specific Node version:
# Create .nvmrc file
echo "20" > .nvmrc
# Then whenever you enter the project:
nvm usePort not accessible from Windows:
# Check if server is running
curl http://localhost:5173
# Or bind to all interfaces explicitly
npm run dev -- --host 0.0.0.0Permission errors:
# Fix npm permissions
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrcSlow file watching:
# Add to package.json scripts or run directly
npm run dev -- --force- Generate — Upload your image and adjust settings
- Export overlay — Download the nail position template
- Print & mark — Print the overlay at your canvas size, use it to position nails
- Route string — Follow the numbered instructions (e.g., "0 → 142 → 67 → ...")
- More nails = finer detail but more complex routing
- More strings = darker image but takes longer to create
- High contrast images work best
- Start with 200 nails and 2000 strings for a good balance
MIT