Metadata-Version: 2.4
Name: vectrify
Version: 0.2.0
Summary: A local SVG editor that turns raster images into editable vector art, with automated tracing and tidying against the reference and an MCP server through which AI agents edit the drawing.
Author-email: Rasmus Ros <rasmus.s.ros@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/rasros/vectrify
Project-URL: Repository, https://github.com/rasros/vectrify
Project-URL: Issues, https://github.com/rasros/vectrify/issues
Keywords: svg,vectorization,raster-to-vector
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Environment :: X11 Applications :: Qt
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cairosvg>=2.7.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: numpy>=2.2.6
Requires-Dist: scipy>=1.11.0
Requires-Dist: shapely<3,>=2.1
Requires-Dist: skia-pathops<1,>=0.9
Provides-Extra: vision
Requires-Dist: torch>=2.0.0; extra == "vision"
Provides-Extra: desktop
Requires-Dist: pywebview>=5; sys_platform != "linux" and extra == "desktop"
Requires-Dist: pywebview[qt]>=5; sys_platform == "linux" and extra == "desktop"
Provides-Extra: mcp
Requires-Dist: mcp>=2.2; extra == "mcp"
Provides-Extra: all
Requires-Dist: vectrify[desktop,mcp,vision]; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-xdist; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: pyrefly; extra == "dev"
Requires-Dist: vulture; extra == "dev"
Requires-Dist: mcp>=2.2; extra == "dev"
Dynamic: license-file

# vectrify

[![PyPI](https://img.shields.io/pypi/v/vectrify.svg)](https://pypi.org/project/vectrify/)
[![Python](https://img.shields.io/pypi/pyversions/vectrify.svg)](https://pypi.org/project/vectrify/)
[![License](https://img.shields.io/pypi/l/vectrify.svg)](https://github.com/rasros/vectrify/blob/main/LICENSE)

vectrify is a local SVG editor for turning a raster image into editable vector
artwork. Load the image as a reference, trace it into shapes, then tidy and
edit the result by hand or let an AI agent edit it over MCP. Every automated
operation previews its result and applies it as one undoable edit.

## Start

```bash
uv tool install "vectrify[all]"     # or: pipx install "vectrify[all]"
vectrify                            # open the editor in its own window
vectrify drawing.svg --reference original.png
vectrify --serve --port 8765        # or serve it to a browser
```

Without the desktop extra, or with --serve, vectrify serves the editor on
loopback and prints the address to open.

## Features

- Drawing: pen, pencil, rectangles, ellipses and lines.
- Point editing: handles, snapping, and Redraw outline, which redraws part of
  an outline along the reference's edge in one stroke.
- Path operations: booleans, merge, combine, join, knife, and a Region tool
  that extracts or deletes what lies inside a shape.
- Clipping, linear gradients edited on the canvas, an eyedropper, line ends,
  arrowheads and tapers.
- Move, resize, rotate, flip, align and distribute, with snapping.
- An object tree with visibility and locks.
- SVG import and export, and .vectrify projects that keep the reference.
- Reference overlay and an error view of where the drawing differs from it.

Press ? in the editor for keyboard shortcuts, or Ctrl/⌘ K to find a command.
The [guide](https://github.com/rasros/vectrify/blob/main/docs/01-intro.md) walks through the editor chapter by chapter.

## Tracing an image

1. Load a PNG, JPEG or WebP image in the Reference panel. Press W to cycle
   between the drawing, the overlay, the reference and the error view.
2. Choose Generate with Cel art for outlined illustrations, or Colour regions
   for anything else, and apply the preview.
3. Select paths and choose Tidy to fit them to the reference and simplify
   them.
4. Fix the rest by hand.
5. Save a project, or export SVG.

Other operations are Fit colours, which fits flat fills or gradients, Clean
up, which drops redundant points and merges paths, and Snap edges, which
closes gaps between touching shapes. They change only the selection and
respect locks. See [Tracing a reference](https://github.com/rasros/vectrify/blob/main/docs/08-tracing.md).

## Agents

vectrify is also an MCP server, so an agent such as Claude Code, Codex or
Claude Desktop can look at the drawing and its reference and edit it with the
editor's own commands.

Turn on Agents in the editor's footer to host the server from the open
window. The popover shows the command to add it to your client, for example:

```bash
claude mcp add --transport http --scope user vectrify http://127.0.0.1:8770/mcp \
  --header "Authorization: Bearer <token>"
```

To edit files without a window, run it over stdio:

```bash
claude mcp add vectrify -- vectrify-mcp
```

See [Agents](https://github.com/rasros/vectrify/blob/main/docs/09-agents.md) for the tools.

## Requirements

Python 3.10 or newer and Cairo (`sudo apt install libcairo2` or
`brew install cairo`). Colour regions needs PyTorch and an NVIDIA GPU. Tidy's
shape fit needs PyTorch and runs on the CPU without a GPU, except for mitered
outlines. Everything else works without either.

On Linux the desktop window uses Qt. If it fails to start, install the system
libraries Qt asks for (often libxcb-cursor0 and libegl1) or use --serve.

An optional CUDA extension speeds up Tidy's shape fit. Releases do not
include it; build it locally with:

```bash
VECTRIFY_BUILD_CUDA_RENDERER=1 uv build --wheel --no-build-isolation
uv pip install --force-reinstall --no-deps dist/vectrify-*.whl
```
