Shenrui-Ma/video-regen-recipes / templates/drawing-process/svg-redraw-comparison
svg-redraw-comparison
Unverified用参考图制作高精度 SVG 临摹绘制过程视频,交付纯 SVG 网页、独立 SVG 和原图对照 MP4。禁止 Canvas、位图嵌入与外链,按构图、线稿、固有色、阴影、高光、细节重放;横图上下、竖图左右合成。
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 1.1 KB |
| LICENSES.md | markdown | 998 B |
| README.md | markdown | 2.5 KB |
| SKILL.md | skill md | 3.8 KB |
| assets/manifest.json | config | 320 B |
| assets/reference.png | binary | 2.7 MB |
| examples/demo.html | other | 30.1 KB |
| examples/foundations.svg | other | 597.0 KB |
| examples/preview.mp4 | binary | 3.2 MB |
| examples/redraw.svg | other | 15.6 MB |
| examples/regions.json | config | 6.7 KB |
| examples/validation.json | config | 2.1 KB |
| profile.json | config | 2.2 KB |
| prompts/author-original.prompt.txt | markdown | 1.2 KB |
| prompts/redraw.prompt.txt | markdown | 1.2 KB |
| references/validation.md | markdown | 1.2 KB |
| references/workflow.md | markdown | 5.0 KB |
| scripts/_contours.py | script | 1.3 KB |
| scripts/_regions.py | script | 1.2 KB |
| scripts/_validate_svg.py | script | 1.5 KB |
| scripts/build_demo.py | script | 5.9 KB |
| scripts/clean_png.py | script | 2.1 KB |
| scripts/export_video.cjs | script | 6.1 KB |
| scripts/package_demo.py | script | 3.4 KB |
| scripts/trace_reference.py | script | 5.0 KB |
| sources.md | markdown | 1.7 KB |
| tests/check_player.cjs | script | 3.9 KB |
| tests/test_pipeline.py | script | 4.2 KB |
| web/load-art.js | script | 3.2 KB |
| web/player.css | other | 738 B |
| web/player.js | script | 2.3 KB |
scripts/_contours.py
View on GitHub"""Trace directed color-region boundaries as closed native SVG subpaths."""
def contours(edges,width):
stride=width+1
def direction(a,b):
delta=b-a
return 0 if delta==1 else 1 if delta==stride else 2 if delta==-1 else 3
def consume(edges,current,previous=None):
choices=edges[current]
if isinstance(choices,int):del edges[current];return choices
if previous is None:index=0
else:
incoming=direction(previous,current);rank={1:0,0:1,3:2,2:3}
index=min(range(len(choices)),key=lambda i:rank[(direction(current,choices[i])-incoming)%4])
out=choices.pop(index)
if len(choices)==1:edges[current]=choices[0]
return out
def trace():
chunks=[];polygons=0
while edges:
start=next(iter(edges));previous=start;current=consume(edges,start);points=[start];last=direction(start,current)
while current!=start:
following=consume(edges,current,previous);d=direction(current,following)
if d!=last:points.append(current)
previous,current=current,following;last=d
points.append(start)
x0=start%stride;y0=start//stride;data=f'M{x0} {y0}'
x,y=x0,y0
for point in points[1:]:
nx=point%stride;ny=point//stride
if nx!=x:data+=f'h{nx-x}'
if ny!=y:data+=f'v{ny-y}'
x,y=nx,ny
chunks.append(data+'z');polygons+=1
return ''.join(chunks),polygons
return trace()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |