hand-svg-structure-figure
Replicate a bitmap/screenshot structure diagram (block diagram, flowchart, network, schematic) as a hand-authored static SVG — programmatic geometry/color probing, live-page export, full pitfall list.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- hand-svg-structure-figure
- description
- Replicate a bitmap/screenshot structure diagram (block diagram, flowchart, network, schematic) as a hand-authored static SVG — programmatic geometry/color probing, live-page export, full pitfall list.
03 SKILL.md 正文
Hand-authored SVG structure-figure replication
When to use
The reference is a bitmap (paper screenshot, scan, slide export) showing a structure figure — block diagram / flowchart / network / schematic — and you need an editable, print-quality vector replica. Do not use this route for data plots (see data-figures-rerender).
Workflow (five steps)
- Probe, don't eyeball. Use
probe_geometry.py(this folder) to extract exact pixel values from the reference bitmap: box bounds via fill-color connected components, circle centers/diameters via ring scans, text-row baselines, connector endpoints, dash/fill/border colors. Build the first draft in the reference's coordinate system — it lands ~80% right with zero guessing. - Copy text verbatim. Every string checked against the reference. Sub/superscripts via
tspan dy(math letters in italic serif; upright digit subscripts need explicitfont-style="normal"— tspans inherit italics). - Hand-write the SVG. Styles centralized in a
<style>block + semantic color constants (see repo-rootMETHOD.md); structural comments per region; default ink color inherited from a wrapping<g fill="...">. - Export PNG.
prepare_export_pages.pybuilds inline-HTML pages → set the browser viewport to the exact content size → plain screenshot (never fullPage — it triggers the tiling bug); for content taller than ~2160 px, capture top/bottom halves and stitch with PIL. - Acceptance. Live-page screenshot + an independent vision-model judge comparing replica vs reference (criteria: every string, arrow source→target topology, no overflow/overlap; intentional style upgrades are not defects). On FAIL, fix root causes using the judge's pixel evidence.
Hard-won pitfalls (all real)
- SVG
<style>overrides presentation attributes:text{fill:…}beatsfill=""on elements → colored titles render near-black. Keepfillout of CSS; inherit defaults from a wrapping<g fill>and set colors per-element. - Never export via
<img src="*.svg">: renders wrong (italic leakage, cascade anomalies); standalone SVG documents screenshot as scaled tiles. Inline HTML is the only reliable channel. - Signature style of fully-connected network figures: incoming edges converge on the target circle's left pole, arrowheads stacked in a cluster — radial rim distribution reads as "wrong".
- Judge "likeness" at the structural-semantic level: the reference is a semantic target, not a pixel template.
Examples (examples/)
fig-prefix-classifier— two-section pipeline figure (blue/orange dashed groups, feedback loop), replicated from a bitmap in the reference coordinate system (ecg_reference.pngis the source bitmap).fig1-1_roadmap— four-stage research roadmap redrawn from a matplotlib source script (coordinates mapped 1:1).
04 同仓库更多 Skills
github-workflow
Umbrella for GitHub auth, repo management, issues, PRs, Mergify, and releases. Subsumes github-auth and repo-manager.
brave-automation
baa CLI: Brave profiles, Google sessions, credentials.
aes
AES docs, layers, rule fixes, and legacy migration.
pretext
Build creative browser demos with DOM-free text layout.
popular-web-designs
54 real design systems (Stripe, Linear, Vercel) as HTML/CSS.
p5js
p5.js sketches: gen art, shaders, interactive, 3D.