Skip to content

Shenrui-Ma/video-regen-recipes / templates/drawing-process/svg-redraw-comparison

svg-redraw-comparison

Unverified

用参考图制作高精度 SVG 临摹绘制过程视频,交付纯 SVG 网页、独立 SVG 和原图对照 MP4。禁止 Canvas、位图嵌入与外链,按构图、线稿、固有色、阴影、高光、细节重放;横图上下、竖图左右合成。

FileKindSize
LICENSEother1.1 KB
LICENSES.mdmarkdown998 B
README.mdmarkdown2.5 KB
SKILL.mdskill md3.8 KB
assets/manifest.jsonconfig320 B
assets/reference.pngbinary2.7 MB
examples/demo.htmlother30.1 KB
examples/foundations.svgother597.0 KB
examples/preview.mp4binary3.2 MB
examples/redraw.svgother15.6 MB
examples/regions.jsonconfig6.7 KB
examples/validation.jsonconfig2.1 KB
profile.jsonconfig2.2 KB
prompts/author-original.prompt.txtmarkdown1.2 KB
prompts/redraw.prompt.txtmarkdown1.2 KB
references/validation.mdmarkdown1.2 KB
references/workflow.mdmarkdown5.0 KB
scripts/_contours.pyscript1.3 KB
scripts/_regions.pyscript1.2 KB
scripts/_validate_svg.pyscript1.5 KB
scripts/build_demo.pyscript5.9 KB
scripts/clean_png.pyscript2.1 KB
scripts/export_video.cjsscript6.1 KB
scripts/package_demo.pyscript3.4 KB
scripts/trace_reference.pyscript5.0 KB
sources.mdmarkdown1.7 KB
tests/check_player.cjsscript3.9 KB
tests/test_pipeline.pyscript4.2 KB
web/load-art.jsscript3.2 KB
web/player.cssother738 B
web/player.jsscript2.3 KB

scripts/clean_png.py

View on GitHub
#!/usr/bin/env python3
"""Losslessly recompress PNG image data and remove optional metadata chunks."""
import argparse
import hashlib
from pathlib import Path
import struct
import zlib

SIGNATURE=b'\x89PNG\r\n\x1a\n'


def parse(data):
    if not data.startswith(SIGNATURE):raise ValueError('Expected PNG input')
    pos=8;chunks=[]
    while pos<len(data):
        if pos+12>len(data):raise ValueError('Truncated PNG')
        size=struct.unpack_from('>I',data,pos)[0];kind=data[pos+4:pos+8];end=pos+12+size
        if end>len(data):raise ValueError('Truncated PNG chunk')
        body=data[pos+8:end-4];crc=struct.unpack_from('>I',data,end-4)[0]
        if zlib.crc32(kind+body)&0xffffffff!=crc:raise ValueError('PNG checksum mismatch')
        chunks.append((kind,body));pos=end
        if kind==b'IEND':
            if pos!=len(data):raise ValueError('Trailing PNG data')
            break
    if not chunks or chunks[0][0]!=b'IHDR' or chunks[-1][0]!=b'IEND':raise ValueError('Invalid PNG structure')
    if any(k in {b'acTL',b'fcTL',b'fdAT'} for k,_ in chunks):raise ValueError('Animated PNG is not supported')
    return chunks


def chunk(kind,body):
    return struct.pack('>I',len(body))+kind+body+struct.pack('>I',zlib.crc32(kind+body)&0xffffffff)


def clean(data):
    chunks=parse(data)
    image=zlib.decompress(b''.join(v for k,v in chunks if k==b'IDAT'))
    out=SIGNATURE;written=False
    for kind,body in chunks:
        if kind==b'IDAT':
            if not written:out+=chunk(kind,zlib.compress(image,9));written=True
        elif kind in {b'IHDR',b'PLTE',b'tRNS',b'IEND'}:out+=chunk(kind,body)
    decoded=zlib.decompress(b''.join(v for k,v in parse(out) if k==b'IDAT'))
    if decoded!=image:raise ValueError('Image data changed')
    return out


def main():
    p=argparse.ArgumentParser(description=__doc__);p.add_argument('input',type=Path);p.add_argument('output',type=Path);a=p.parse_args()
    raw=a.input.read_bytes();out=clean(raw)
    with a.output.open('xb') as f:f.write(out)
    print('Image data unchanged; output SHA-256:',hashlib.sha256(out).hexdigest())

if __name__=='__main__':main()
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
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: 196kUpdated Claude CodeCodexVerifiedInstall