vectorizelisted
Install: claude install-skill MohamedAbdallah-14/prompt-to-asset
# Vectorize
## Three paths
### 1. Recraft `/vectorize` (hosted, highest quality)
Input: any raster. Output: clean SVG, typically 20–100 paths for a mark, 200–500 for an illustration. Commercial tier only.
```ts
const svg = await recraft.vectorize({ image: pngBuffer });
```
### 2. `vtracer` (local, multi-color polygon)
- Rust binary; `npm install vtracer` for the Node wrapper.
- Modes: `polygon` (recommended for logos), `spline` (smoother curves), `pixel` (blocky).
- Color count controlled upstream via K-means quantization before vectorization.
```
pipeline:
raster 1024²
→ BiRefNet matte (alpha the background)
→ K-means LAB 6-color palette
→ vtracer --mode polygon --filter-speckle 4 --color-precision 6
→ SVGO (conservative preset)
```
### 3. `potrace` (local, 1-bit)
- Classical Stan Ford vectorizer; binary output only (no color).
- Best for: icon packs (single-color), typography work, line art.
- Multi-color workaround: separate each color into its own 1-bit layer, vectorize each, stack SVG `<g>`s.
```
pipeline:
raster 1024²
→ BiRefNet matte
→ per-color mask (binary threshold per palette entry)
→ potrace per mask → <g> wrapper
→ combine into single SVG
→ SVGO
```
## Choosing the path
| Use case | Path |
|---|---|
| Budget available, one-shot quality | Recraft vectorize |
| Multi-color logo, local | vtracer (polygon mode) |
| Single-color icon pack | potrace |
| Photorealistic illustration → vector | don't — keep as PNG/WebP. Vectorization of p