CAM software for embroidery machines
Find a file
Mark Whaite c0c9044285
Some checks failed
CI / Lint (push) Successful in 27s
CI / Type Check (push) Successful in 1m35s
CI / Test (fast) (push) Failing after 6m24s
CI / Test (slow) (push) Failing after 4m13s
CI / Test (Python 3.12) (push) Failing after 6m19s
CI / Test (Python 3.11) (push) Failing after 3h10m26s
Apply changes from kilo-gsd.py run for Mark/easystitch#132
2026-09-17 20:16:52 -07:00
.forgejo/workflows ci(matrix): narrow to Python 3.11/3.12 (scikit-image pin blocks 3.9/3.10) 2026-09-11 22:48:25 -07:00
.gsd test(pipeline): add 1024x1024 latency benchmark for issue #127 2026-09-08 14:38:47 -07:00
config Initial commit: EasyStitch MVP foundation 2026-05-09 18:16:51 -07:00
data Apply changes from kilo-gsd.py run for Mark/easystitch#124 2026-09-08 12:25:00 -07:00
docs docs(digitize): document 422 for unsupported SVG paint servers 2026-08-11 02:35:57 -07:00
manual fix #14: test_files/ tests fail with ImportError — stale tests referencing non- 2026-05-14 17:24:47 -07:00
src Apply changes from kilo-gsd.py run for Mark/easystitch#132 2026-09-17 20:16:52 -07:00
test_files fix(tests): repair test_files/ collection + assertions for current API 2026-06-25 11:14:19 -07:00
tests fix(#132): fail loudly on unresolved gradient/pattern fills (no silent empty success) 2026-09-17 19:46:03 -07:00
.dockerignore Add Dockerfile + deployment config (Mark/easystitch#88) 2026-06-26 13:28:42 -07:00
.gitignore chore: gitignore .worktrees/ (kilo agent-manager runtime artifacts) 2026-09-17 19:31:35 -07:00
.pre-commit-config.yaml quickfix: document and pin first-time venv setup (refs #42) 2026-06-22 13:06:53 -07:00
=0.0.12 Apply changes from kilo-gsd.py run for Mark/easystitch#84 2026-06-26 11:50:08 -07:00
app.py Apply changes from kilo-gsd.py run for Mark/easystitch#92 2026-06-28 00:00:37 -07:00
app.yml Add Dockerfile + deployment config (Mark/easystitch#88) 2026-06-26 13:28:42 -07:00
backlog.csv Add comprehensive user manual and enhanced features 2026-05-09 18:16:51 -07:00
config.py Apply changes from kilo-gsd.py run for Mark/easystitch#92 2026-06-28 00:00:37 -07:00
docker-compose.yml Add Dockerfile + deployment config (Mark/easystitch#88) 2026-06-26 13:28:42 -07:00
Dockerfile Add Dockerfile + deployment config (Mark/easystitch#88) 2026-06-26 13:28:42 -07:00
IMPLEMENTATION_PLAN.md fix(#132): fail loudly on unresolved gradient/pattern fills (no silent empty success) 2026-09-17 19:46:03 -07:00
package.json quickfix: runner-side fallback commit for #32 2026-06-22 12:35:07 -07:00
pipeline_runner.py fix(docs): clarify pipeline_runner stub status (#102) 2026-07-29 09:29:55 -07:00
pyproject.toml fix(test/lint): align benchmark file path with plan and clean formatting 2026-09-08 14:42:53 -07:00
README.md fix(cli): rewrite src/main.py to match README contract (Mark/easystitch#124) 2026-09-08 12:20:07 -07:00
requirements.lock quickfix: document and pin first-time venv setup (refs #42) 2026-06-22 13:06:53 -07:00
requirements.txt ci(forgejo): install libgl1 + add httpx for test collection 2026-09-11 21:41:34 -07:00
setup.py Add Dockerfile + deployment config (Mark/easystitch#88) 2026-06-26 13:28:42 -07:00
test_acceptance.py fix: organize acceptance test imports 2026-07-25 12:32:06 -07:00
test_enhanced_features.py fix #14: test_files/ tests fail with ImportError — stale tests referencing non- 2026-05-14 17:24:47 -07:00
test_http_acceptance.py fix: organize acceptance test imports 2026-07-25 12:32:06 -07:00
test_http_simple.py fix: organize acceptance test imports 2026-07-25 12:32:06 -07:00
test_output.svg Add comprehensive user manual and enhanced features 2026-05-09 18:16:51 -07:00
User_Manual.md Add comprehensive user manual and enhanced features 2026-05-09 18:16:51 -07:00

EasyStitch - SVG to Embroidery Converter

EasyStitch is a Python application that converts SVG files into embroidery machine files. Support various embroidery formats like DST, PES, EXP, and JEF for use with embroidery machines.

Features

  • Convert multiple formats - SVG files and raster images (PNG, JPG, etc.) to embroidery formats (DST, PES, EXP, JEF)
  • Ultra-fine detail - Default 0.4mm stitch spacing for high quality output
  • Intelligent semantic analysis - Automatic stitch type classification (running, fill, satin) with human override capability
  • Advanced path optimization - Minimize travel distance and thread changes with multiple algorithms
  • Professional color matching - Delta E-based color matching with thread library support
  • Advanced fill algorithms - Tatami patterns with offset algorithms to prevent stitch junction alignment
  • Complete visualization & analysis - Generate previews and detailed stitch analysis reports
  • Machine-specific optimization - Support for Brother, Tajima, Melco, Janome and other machine profiles
  • Configurable stitch parameters - Fine-tune density, spacing, and other settings per element type
  • Command-line interface - Comprehensive CLI with dozens of options for advanced control
  • Automatic raster vectorization - Convert bitmap images to vector paths for embroidery
  • Quality validation - Automatic checking for common embroidery issues and thread conflicts

Quick Start

Basic Usage

# Convert SVG to DST (most common format)
python src/main.py input.svg

# Convert to specific format with output file
python src/main.py input.svg -f pes -o output/my_design.pes

# Convert raster image (automatic vectorization)
python src/main.py logo.png -f dst -o logo.dst

Enhanced Options

# Generate with analysis and visualization
python src/main.py design.svg --visualize --analyze

# Optimize path for minimal travel and thread changes
python src/main.py design.svg --optimize-path --analyze

# Fine-detail conversion (0.4mm spacing for high quality)
python src/main.py detailed_design.svg --fill-density 0.4 --satin-stitch-spacing 0.4

First time setup

# Clone the repository
git clone <repository-url>
cd easystitch

# Create a local virtual environment
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install the pinned project dependencies
pip install -r requirements.txt

# Install EasyStitch in editable mode so the `src` package is importable
pip install -e .

Verify the environment:

python -c "from src.main_pipeline import EmbroideryPipeline"

For a fully reproducible environment, install from the transitive lock file instead:

pip install -r requirements.lock
pip install -e .

Usage

Basic Conversion

# Basic conversion to DST format (default)
python src/main.py input.svg

# Specify output format
python src/main.py input.svg -f pes -o output.pes

# Convert raster image to embroidery format
python src/main.py input.png -f dst -o output.dst

Advanced Usage with New Features

Fine Detail Options (0.4mm defaults)

The system now uses 0.4mm default spacing for superior quality:

# Use default 0.4mm spacing (recommended for most applications)
python src/main.py input.svg --fill-density 0.4 --running-stitch-spacing 0.4

# Customize stitch density for specific quality
python src/main.py input.svg --fill-density 0.3 --satin-stitch-spacing 0.4 --running-stitch-spacing 0.4

Semantic Analysis & Visualization

# Generate visualization of embroidery pattern
python src/main.py input.svg --visualize

# Generate analysis report
python src/main.py input.svg --analyze

# Generate both visualization and analysis
python src/main.py input.svg --visualize --analyze

Path Optimization

# Enable path optimization to minimize travel distance between elements
python src/main.py input.svg --optimize-path

# Use specific optimization method
python src/main.py input.svg --optimize-path --path-optimization-method nearest_neighbor

Fill Pattern Customization

# Use advanced fill algorithms with offset patterns
python src/main.py input.svg --fill-type advanced_tatami

# Set fill angle and density
python src/main.py input.svg --fill-angle 45 --fill-density 0.4

Custom Thread Management

# Process with thread analysis and optimization
python src/main.py input.svg --analyze

# Use thread configuration file (when available)
python src/main.py input.svg --threads config/threads.json

Complete Example with All Features

# Full featured conversion with optimization and analysis
python src/main.py design.svg \
  -f pes \
  -o output/design.pes \
  --fill-density 0.4 \
  --fill-type advanced_tatami \
  --fill-angle 45 \
  --optimize-path \
  --path-optimization-method color_grouped \
  --visualize \
  --analyze

By default EasyStitch writes generated embroidery files next to the input SVG. Set the EASYSTITCH_OUTPUT_DIR environment variable to direct all generated files (including analysis PNGs) into a dedicated folder:

export EASYSTITCH_OUTPUT_DIR=outputs
python src/main.py input.svg          # writes to outputs/input.dst

CLI migration notes (issue #124)

The CLI now matches the documented surface end-to-end:

  • python src/main.py input.svg works as the README quick-start shows. All three invocation forms (python src/main.py …, python -m src.main …, easystitch …) are equivalent.
  • All four formats (DST, PES, EXP, JEF) are produced via the real EmbroideryPipeline.process(...). The old "Format pes not yet implemented" stub branch is gone.
  • Raster inputs (PNG/JPG/BMP/GIF/TIFF/WebP) are accepted and routed through auto-vectorization. The old "Input file must be an SVG file" error is gone.
  • EASYSTITCH_OUTPUT_DIR is now honoured as documented.
  • The following flags are accepted for backward compatibility but currently no-op with a one-line stderr warning (issue #124 follow-up work will land real engine support): --optimize-path, --path-optimization-method, --fill-type, --fill-angle, --threads.

Supported Input Formats

  • SVG (Scalable Vector Graphics) - vector input
  • PNG, JPG, BMP, GIF, TIFF, WebP - raster input (automatically vectorized)

Supported Output Formats

  • DST (Tajima) - Most widely supported format
  • PES (Brother) - For Brother and compatible machines
  • EXP (Melco) - For commercial embroidery machines
  • JEF (Janome) - For Janome machines

Project Structure

easystitch/
├── src/                    # Source code
│   ├── main.py            # CLI entry point (issue #124)
│   ├── main_pipeline.py   # 5-stage pipeline orchestrator (EmbroideryPipeline)
│   ├── config.py          # Configuration models
│   ├── svg_parser/        # SVG parsing module
│   ├── embroidery_converter/ # Conversion logic
│   ├── output_generators/ # Embroidery format generators
│   └── utils/             # Utility functions
├── tests/                 # Test files
├── config/                # Configuration files
├── docs/                  # Documentation
├── data/                  # Sample data
├── requirements.txt       # Python dependencies
└── README.md             # This file

Development

To contribute to EasyStitch:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests if applicable
  5. Run tests (pytest)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Supported Formats

  • DST - Tajima embroidery format
  • PES - Brother embroidery format
  • EXP - Melco embroidery format
  • JEF - Janome embroidery format

Roadmap

✅ COMPLETED PHASES

  • SVG parsing with support for paths, shapes, and text
  • Raster image vectorization and preprocessing
  • Path optimization and reduction algorithms
  • Multiple embroidery format support (DST, PES, EXP, JEF)
  • Thread color mapping and Delta E matching
  • Satin stitch detection and generation
  • Advanced fill stitch algorithms (tatami with offset patterns)
  • Semantic annotation and automatic classification
  • Machine-specific optimization and constraints
  • Ultra-fine detail support (0.4mm defaults)
  • Complete visualization and analysis system
  • Path optimization to minimize travel distance

🔄 CURRENT PHASE

  • GUI interface for visual editing and preview

📋 FUTURE ENHANCEMENTS

  • Advanced underlay stitch generation
  • Pull compensation for satin stitches
  • 3D/padding stitch support
  • Advanced path planning with multiple hoop positions
  • Real-time preview capabilities

License

This project is licensed under the MIT License - see the LICENSE file for details.