Skip to content
Skills Library
Design & UX · Conversion & formats

vectorize-logo

/vectorize-logo

Vectorize a flat-colour raster logo (PNG/JPEG, often AI-generated) into exact SVG geometry and prove it against the source by rendering and diffing. Use to trace, redraw or reverse-engineer a logo, icon or mark as SVG; to make mono, inverted or app-tile variants of one; or to find which of its edges are simple arcs, sines or ellipses for a constructed redesign.

Licence
MIT
Last repository change
04.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 04.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Vectorize a flat-colour raster logo (PNG/JPEG, often AI-generated) into exact SVG geometry and prove it against the source by rendering and diffing. Use to trace, redraw or reverse-engineer a logo, icon or mark as SVG; to make mono, inverted or app-tile variants of one; or to find which of its edges are simple arcs, sines or ellipses for a constructed redesign.

Original author description

Vectorize a flat-colour raster logo (PNG/JPEG, often AI-generated) into exact SVG geometry and prove it against the source by rendering and diffing. Use to trace, redraw or reverse-engineer a logo, icon or mark as SVG; to make mono, inverted or app-tile variants of one; or to find which of its edges are simple arcs, sines or ellipses for a constructed redesign.

How it works

  1. Steps
  2. Invariants
  3. Test
Original SKILL.md headings · 78 lines, 1,227 words
SKILL.md preview
---
name: vectorize-logo
description: Vectorize a flat-colour raster logo (PNG/JPEG, often AI-generated) into exact SVG geometry and prove it against the source by rendering and diffing. Use to trace, redraw or reverse-engineer a logo, icon or mark as SVG; to make mono, inverted or app-tile variants of one; or to find which of its edges are simple arcs, sines or ellipses for a constructed redesign.
---

# Vectorize a logo

The scripts in `scripts/` (paths here are relative to this repository's root, the skill's directory; each takes `--help`) turn a flat-colour logo into SVG whose edges sit on the source's sub-pixel edges, then prove it. They need Python 3 with numpy, Pillow and matplotlib (for contourpy). Verification needs a Chromium: `--chrome PATH`, `$CHROME`, one on PATH, or a Playwright download under `~/.cache/ms-playwright`.

Scope: flat fills with anti-aliased edges. Photos, gradients, textures and soft shadows are out of scope; say so instead of tracing them.

## Steps

1. **Read the source.** Open the image. Name its flat colours, whether a circular frame (ring) encloses the mark, its sharp tips, its holes (an eye, a letter counter) and its thin tapers.
   Done when you can state the palette and ring you expect.

2. **Trace.**

   ```sh
   python3 scripts/reverse_engineer.py SOURCE.png OUT --colour --mono --inverted --tile
   ```

   Compare the printed palette, paint order, ring and stretch with step 1. For a missing, extra or merged colour, rerun with every colour given as `--palette name=#hex` (background included) or with `--colours N`. When you expected a ring and it prints `ring: none (reason)`, act on the reason; use `--ring none` for a mark that only looks round.
   Done when the printed palette and ring match what you see.

3. **Verify**, after every trace:

   ```sh
   python3 scripts/verify.py SOURCE.png OUT/colour.svg OUT/verify
   ```

   It renders with headless Chromium on the source's own pixel grid, re-applying the stretch recorded in `OUT/meta.json`, and prints the mean absolute difference, the share of pixels off by more than 60, and the pixels drawn outside the ring on a dark page. Then open and look at:
   - `side.png` (source | render) for missing or extra shapes;
   - `dark.png` for halos and light fringes;
   - every `zoom-NN-<kind>.png`: source pixels left, the vector at 12x right, one per tip, rounded tip and ring join. Add `--zoom X,Y` for any join or tip the checkpoints missed.

   Done when the limits print `ok`, the outside-the-ring count is 0, and in every zoom pair the vector edge runs along the source's anti-aliased edge with no seam, halo, chamfer or blob. A clean AI-generated logo lands near 2/255 mean difference with under 1% of pixels off by more than 60; noise in the source sets the floor.

4. **Fix and re-verify** until step 3 passes. The defect points to its lever:

   | Defect in the zooms | Lever |
   | --- | --- |
   | A corner where the source is smooth, or a smooth bend where it has a point | `--corner-angle` (higher means fewer corners) |
   | A blunt end reads as a chamfer, or a rounded tip comes out as two corners | `--tip-gap` |
   | A wobbly edge, or one that cuts across a real bump | `--smooth`, `--tolerance` |
   | Colour slivers along an edge, or an edge off by a fraction of a pixel | `--palette` with the exact flat colours |
   | The wrong colour on top where two colours meet | `--order` |
   | Specks traced as shapes | `--min-length` |

   When no flag fixes a defect, report it with its zoom and keep the generated paths as they are.

5. **Check the variants.** Render each with `verify.py SOURCE.png OUT/<variant>.svg OUT/verify-<variant> --max-mean 255` (only the colour variant is diffed against the source) and look at its `dark.png`. `mono` is one ink, with a layer drawn over another layer kept mid grey so their boundary survives; `inverted` is light on dark; `tile` is an app icon on a rounded square, ring dropped.
   Done when each variant reads cleanly on the dark render.

6. **Find the primitives**, when a constructed redesign is wanted:

   ```sh
   python3 scripts/analyze_primitives.py SOURCE.png [the trace options] --json OUT/primitives.json
   ```

   Each edge between corners is fitted with a line, a circular arc and a sine wave (an outline without corners also with an ellipse); `SIMPLE` rows fit within 0.5px rms, reported as the simplest primitive that fits. Non-simple edges are also split at their inflection points. Use the simple edges as construction geometry (exact radii, one wavelength shared by a family of waves) and treat the rest as freehand curves.

7. **Report** the output files; the palette, ring and stretch; the mean difference, share over 60 and outside-the-ring count; each zoom you reviewed and what it showed; and any defect left.

## Invariants

Each of these was once a visible defect. The scripts implement them. Check them in the zooms, and keep them when changing a script or an SVG by hand.

- **Sub-pixel edges.** Each anti-aliased pixel is a mix of two palette colours, so each colour has a soft field whose 0.5 iso-contour is its edge. When one colour sits near the line between two others (dark grey between black and white), colour alone cannot tell a black/white edge pixel from a grey mix. The pair cost therefore adds each colour's distance to its nearest flat region: no grey slivers along black/white edges, and a grey highlight's thin taper inside black stays grey.
- **Corners only at true tips.** A true corner turns as sharply over 3px as over 7px; a tight smooth bend, such as the end of an eye, turns half as much and stays smooth. Each corner snaps to where its two arms meet, so the edges beside it stay straight. Between corners: Gaussian smoothing with the endpoints pinned, then Schneider cubic fitting at about 0.6px.
- **Two corners close together are one small rounded tip.** Keep it smooth; two sharp corners there read as a chamfer.
- **A ring is exact circles.** AI images are often slightly stretched (one source was 0.709% wider than tall). Fit an axis-aligned ellipse to the ring's outer edge all the way round, undo the stretch, then make the two circles concentric so the band is constant.
- **Circles are four quarter arcs.** With two half arcs the arc centre is ambiguous; a 0.005px rounding then swings each half about 2px and the ring grows.
- **Pixel centres sit at +0.5.** Pixel (row i, column j) covers [j, j+1] × [i, i+1] in SVG units; geometry taken straight from array indices lands half a pixel up and left.
- **No seams.** A shape that meets the ring continues along its own tangent about 2.5px under the stroke, the scene is clipped there, and the ring is painted on top. A lower layer continues under each upper layer it borders. The background disc ends under the ring, or inside the clip when the ring is dropped, so no halo shows on a dark page.
- **Holes are evenodd.** Each colour is one path holding all its outlines with `fill-rule="evenodd"`: an eye patch is a hole in the body, not a white shape on top of it.
- **Verify on the source's own grid.** Re-apply the stretch for the diff. Chromium's new headless mode gives a viewport about 87px shorter than `--window-size`, so render taller and crop.

## Test

`python3 tests/test_vectorize.py` generates two logos with known geometry using `examples/make_example.py`. One has a ring, a 0.6% stretch, sine-wave water and a sharp-tipped fin with an eye hole; the other has no ring. The test traces both and checks palette, circles, stretch, tips and the wave's sine fit, plus the render diff when a Chromium is found. `make_example.py` also gives a quick end-to-end demonstration on a known input.
Files in this package (4)
  • .gitignore 1 KB
  • LICENSE 1 KB
  • README.md 4 KB
  • SKILL.md 8 KB

Versions

The database has no other skills named vectorize-logo.

Database snapshot: 13.11.2026 · package version 51d7f9090278 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100vectorize-icon
    Rebuild a raster logo, mascot, character or app icon as a clean, editable, pixel-accurate SVG (or inline SVG in HTML), with smooth curves and fitted gradients, shading and shadows, verified against the original. Use when the user asks to vectorize, trace, convert to SVG,…
  • 100vectorize
    Use when the user wants to trace a raster image (PNG/JPEG) into an SVG vector — useful for logos, line art, diagrams, and stylized illustrations. Wraps `vtracer` (Rust-backed, via Python wheel in the plugin venv). Companion to `svg-to-raster` (other direction).
  • 100brand-assets
    Professional logo/brand asset pipelines — vectorize a PNG logo into a multi-color SVG, finalize an SVG (clamp fills to exact brand hexes, filter extraneous counters, square a viewBox), rasterize SVG back to pristine PNG at target size/padding, and generate a full favicon +…
  • 95logo-animation
    Build 16:9 HTML logo animations for any SVG or raster logo: prepare or trace the artwork, design reusable variations, verify frame-exact holds, and render MP4. Use when the user asks to animate a logo, create a logo motion study, add logo variations, trace a raster logo, or export a logo video.
  • 80Logo design
    Design a logo system for an app or system interactively, presenting five distinct versions before writing any SVG. Use when the user asks to create, redesign or explore a logo, icon, mark, favicon or brand mark.
  • 100trace-image-to-svg
    Traces a raster image, such as a logo, wordmark, icon or glyph art, into a pixel-faithful SVG of smooth Bezier paths with a transparent background, no embedded raster and no font dependency, scored against the source. Use when asked to trace, vectorize or convert an image to SVG…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.