png-to-svg
Skill2 starsChanged 4 months agoMITView on GitHub
Convert PNG and other raster icon artwork into clean, editable, transparent SVG geometry. Use when Codex must reconstruct a supplied PNG, JPG, WebP, screenshot crop, logo, glyph, wordmark, or generated icon as a true SVG; remove a baked background; preserve a combined mark; or audit and refine an SVG against its raster source. Do not use for ordinary photo vectorization or for SVG files that merely embed a bitmap.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- rajnandan1/such-skillstheir own version, first seen Mar 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- rajnandan1/such-skills★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repositoryOne other file it gives its agents.
- create-svg-iconSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 8 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Leave the SVG canvas transparent and exclude every source-background pixel.
- Distinctive: line 17
Prefer the fewest clean primitives and Bézier points that explain the raster.
- Distinctive: line 18
Do not search for an original SVG or substitute an icon-library asset.
- Very specific: line 38
Read references/geometry-and-qa.md.
- Very specific: line 49
Use a tight viewBox unless source whitespace is intentional.
- Distinctive: line 51
Keep the graphic editable:
- Very specific: line 54
use fill-rule="evenodd" or masks for true cutouts.
- Distinctive: line 55
avoid unnecessary transforms, clipping, filters, and path knots.
- Distinctive: line 56
do not add metadata, editor cruft, or hidden fallback rasters.
- Distinctive: line 60
Run the bundled dependency-free audit after every structural rewrite:
- Distinctive: line 80
Stop when the structure is clean and the reference-size render is visually faithful.
- Very specific: line 94
Always deliver the .svg. Keep audit reports and comparison renders as QA evidence when they help.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PNG to SVG
Reconstruct the visible foreground as deliberate vector geometry. Treat the raster as evidence, not as content to wrap inside an SVG.
Resolve <skill-dir> to the directory containing this file. Resolve all bundled paths from it.
Hard requirements
- Produce real SVG primitives and paths. Never use
<image>, raster data URLs,foreignObject, CSS background images, or external asset references. - Leave the SVG canvas transparent and exclude every source-background pixel.
- Preserve the requested lockup, spacing, alignment, palette, negative space, and optical weight.
- Prefer the fewest clean primitives and Bézier points that explain the raster. Do not ship a noisy automatic trace.
- Do not search for an original SVG or substitute an icon-library asset. Reconstruct only from the supplied raster and user facts.
- State genuine ambiguity instead of inventing hidden geometry.
Workflow
1. Inspect the source
View the original at native size and zoomed in. Record:
- canvas dimensions, alpha channel, and likely background;
- foreground bounds and intended whitespace;
- dominant colors and antialiasing fringe;
- symmetry axes, repeated widths, radii, angles, and negative spaces;
- whether the form is best explained by strokes, fills, or both;
- whether several visible parts form one lockup or separate assets.
For an opaque source, explicitly identify and remove the background. For a textured or ambiguous background, separate the intended foreground semantically and inspect every edge.
2. Form a geometry model
Read references/geometry-and-qa.md. Start with the lowest adequate complexity:
- circles, ellipses, lines, polylines, rectangles, rounded rectangles, and arcs;
- small primitive composites and negative-space cutouts;
- a few deliberate cubic curves with tangent continuity;
- a simplified custom outline only for a genuinely irregular silhouette.
For line icons, test a centerline-stroke model before drawing both edges as an outline. Infer a shared stroke width, caps, joins, and corner language. For filled icons, reconstruct the silhouette and open interior holes rather than painting them with the source background color.
3. Author the SVG
Use a tight viewBox unless source whitespace is intentional. Use semantic ids, explicit colors, readable coordinates, and reusable definitions only when they reduce complexity. Prefer currentColor when the user wants a themeable monochrome UI icon; otherwise preserve explicit colors.
Keep the graphic editable:
- retain simple primitives when they express the form clearly;
- use
fill-rule="evenodd"or masks for true cutouts; - avoid unnecessary transforms, clipping, filters, and path knots;
- do not add metadata, editor cruft, or hidden fallback rasters.
4. Audit and render
Run the bundled dependency-free audit after every structural rewrite:
python <skill-dir>/scripts/svg_audit.py output.svg --report output.audit.jsonAny raster embedding, script, foreignObject, external reference, invalid root, or missing viewBox is a hard failure.
Render the SVG at the source reference size using an available browser, SVG viewer, or existing renderer. Do not install a renderer unless the user asks. Compare the render against the source on both light and dark contrasting backgrounds.
5. Refine in order
Change only a few parameters per pass, in this order:
- foreground separation, canvas, placement, scale, and optical centering;
- topology, open/closed structure, and negative space;
- extrema, symmetry, radii, corner positions, and shared angles;
- stroke width, caps, joins, and local weight;
- curve tangents, subpixel placement, and color.
Stop when the structure is clean and the reference-size render is visually faithful. A smooth primitive with correct topology is preferable to a jagged trace with marginally closer pixels.
Acceptance gate
Deliver only when all are true:
svg_audit.pyexits successfully;- the canvas is transparent and no background shape remains;
- the icon reads correctly at its intended size and at 200–400% zoom;
- curves, corners, endpoints, and holes are clean;
- repeated visual rules are consistent;
- the SVG contains only editable vector geometry;
- filenames are lowercase kebab-case and describe the icon.
Always deliver the .svg. Keep audit reports and comparison renders as QA evidence when they help; do not clutter the final handoff with intermediate masks or failed candidates.
References
references/geometry-and-qa.md— geometry recipes, optical corrections, and comparison criteria.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

