Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
docs: video pipeline route in SKILL/README, Unreleased changelog, version 1.62.0 (not released)
Soohong Kim2275a99e1ad0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3337fbd..7126dac 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,11 @@All notable public changes to `sprite-gen` are recorded here. Versions track the `version:` field in `SKILL.md` and `pyproject.toml`.+## Unreleased (v1.62.0) - Video to Sprite++- Added the `sprite_gen/video` domain: `sprite-gen video-canvas` (state canvas — tall for jumps, wide for attacks, square otherwise; the still's corner key fills the padding), `sprite-gen video-frames` (ffmpeg extraction + cutout keying with an edge-contact gate), `sprite-gen video-loop` (global-period cycle detection, strip with `body_h` metadata, 1-bit-alpha GIF, `img2webp -exact` WebP, seam and periodicity gates, output re-verification) and `sprite-gen video-set` (directions × states with staggered starts and a bounded HTTP 429 retry, per-item reports and a table).+- Declared `ffmpeg` and `img2webp` as required binaries for the video pipeline; `docs/video-pipeline.md` records the contract and the 2026-09-08 measurements it comes from.+## v1.61.0 - Image to Video- Added `sprite-gen video`: one still + prompt → a verified mp4 through Grok Imagine (`POST /v1/videos/generations`), with duration 1–15 s, 480p/720p/1080p, optional aspect ratio and audio flag, and a `sprite-gen-video-report` JSON.diff --git a/README.md b/README.mdindex 789573d..0fc982b 100644--- a/README.md+++ b/README.md@@ -261,6 +261,15 @@ with the repo; the report says which one ran. An expired login stops beforeuploading and tells you the exact refresh command. Setup, parameters, and theverification contract: [`docs/video.md`](docs/video.md).+### Video → sprite loops++`sprite-gen video-set --base side=still.png --states idle,walk,run,jump,attack --out-dir set/`+turns one still into a seamless, transparent loop per state: the still is padded into+the canvas the state needs (jumps tall, attacks wide), animated in place by Grok+Imagine, keyed frame by frame, and cut at its true period into a strip, a GIF and a+WebP — each stage measured and fail-loud. Contract and the measured rules behind it:+[`docs/video-pipeline.md`](docs/video-pipeline.md).+## AttributionThe component-row workflow is inspired by the Apache-2.0 licensed `hatch-pet` skill, but targets generic game sprite atlases and includes no pet packages or pet visual assets.diff --git a/SKILL.md b/SKILL.mdindex 9768904..8408ccd 100644--- a/SKILL.md+++ b/SKILL.md@@ -1,6 +1,6 @@---name: sprite-gen-version: 1.61.0+version: 1.62.0description: "Generate clean 2D game sprites and animation atlases with a component-row pipeline: base identity, numeric sprite-request SSoT, per-state layout guides, image-gen row strips, chroma-key alpha cleanup, connected-component frame extraction, cell-based atlas composition, QA reports, and runtime manifest frame_layout. Its curation webview also serves ANY image-candidate set (icons, logos, generated drafts) — agent chat can't render images, this can: unpack_atlas_run --pngs-dir import, then serve_curation side-by-side compare/pick. Palette-swap bake (`sprite-gen recolor`) turns a base sheet + palette map into N colourway sheets; the curation view blink-compares and adopts a pick into curation.json.recolor.picked. Curation triggers (KR/EN): 큐레이션, 큐레이션뷰, 큐레이션 해줘, 이미지 후보 보여줘/안 보임, 나란히 비교, 골라볼게 띄워줘, curation view, show image candidates side by side, let me pick. Recolor triggers (KR/EN): 팔레트 스왑, 팔레트 베이크, 리컬러, 색깔 바꾸기, 컬러웨이, 색 변형, 팔레트 맵, 색갈이, palette swap, recolor, colourway, colorway, bake variants, palette map."license: Apache-2.0depends_on:@@ -9,10 +9,18 @@ depends_on:why: "gen --provider codex (image_gen via ChatGPT OAuth)"- name: grokwhy: "gen --provider grok (Imagine via xAI OAuth)"+ - name: ffmpeg+ why: "video-frames (clip -> frames) and video-set"+ - name: img2webp+ why: "video-loop WebP with exact alpha (libwebp); Pillow's animated writer drops -exact"required_scripts:- scripts/prepare_sprite_run.py- scripts/generate_sprite_image.py- scripts/generate_sprite_video.py+ - scripts/video_canvas.py+ - scripts/video_frames.py+ - scripts/video_loop.py+ - scripts/video_set.py- scripts/extract_sprite_row_frames.py- scripts/interpolate_frames.py- scripts/compose_sprite_atlas.py@@ -197,6 +205,7 @@ Scripts are explicit pipeline commands, not hidden imports. One job each (stage- `unpack_atlas_run.py` — inverse of compose: rebuild a curator-ready run dir from a finished sheet (`--grid` > `--manifest` > auto-detect) or import a PNG folder (`--pngs-dir`, with sibling `meta.json` labels/iso grid).- `export_curated_pngs.py` — export curated frames back to named PNGs with the transform baked in, into `<run-dir>/curated/`; the deliverable for imported still sets.- `sprite_gen/gen/video.py` (`sprite-gen video`) — one still → verified mp4 through Grok Imagine (`POST /v1/videos/generations`) with the user's own credential: `XAI_API_KEY` if set, else the `grok` CLI login (`~/.grok/auth.json`, SuperGrok Imagine quota). Expired login fails before upload with the refresh command; tokens/URLs never reach the report. The `grok-imagine-video` skill is a thin shuttle over this. Contract: [`docs/video.md`](docs/video.md).+- **Video → sprite pipeline** (`sprite_gen/video/`, [`docs/video-pipeline.md`](docs/video-pipeline.md)) — one still → a seamless transparent loop per motion state: `video-canvas` (state canvas: jump tall, attack wide, else square — the API ignores aspect_ratio, the input frame decides) → `video` → `video-frames` (ffmpeg + cutout keying, edge-contact fail-loud) → `video-loop` (global period first — the 1.5-cycle gait trap — then best seam; strip + `body_h` meta, 1-bit GIF, `img2webp -exact` WebP, seam gate) → `video-set` (directions × states, 2 s staggered starts + bounded 429 retry, table). Render strips at 24 fps: one cell per frame.- `cutout.py` (`sprite-gen cutout`) — background remover for **imported** images (not pipeline output, which is already keyed). Routes on the corner background colour (`--key auto|white|magenta|green`): **white/ivory** → position matte (corner flood-fill keeps interior highlights unholed → decontaminated soft-alpha border + soft erode); **magenta/green key** → reuse the verified `extract.remove_chroma_background` engine as-is (no drift — key colours are absent from objects so its colour-only cut is safe there). `--white-check` writes cyan/magenta/yellow verification composites. No Silent Fallback (leftover non-zero RGB under transparency raises).- `slice_sheet_cells.py` — slice a multi-figure grid sheet (same character, N expressions/variants in one image) into per-cell standing cuts: v1.13 chroma alpha + centroid cell assignment + merged-figure split/in-cell re-label + neighbour-debris drop + per-cell height normalization + shared feet baseline. For dialogue cut-in portraits (立ち絵), not animation rows. Detail: [`docs/sheet-slicing.md`](docs/sheet-slicing.md).- `check_visible_magenta.py` — optional screenshot QA guard for visible chroma-key leakage.@@ -508,6 +517,7 @@ sprite-gen (this SKILL.md = behavior contract + hub)├─ GENERATION ── "raw/<state>.png from prompts (the one AI step)"│ ├─ docs/gen.md # sprite-gen gen provider CLI · verified PNG/report · image-gen shuttle│ ├─ docs/video.md # sprite-gen video · Grok Imagine i2v with the user's own grok login / XAI_API_KEY+│ ├─ docs/video-pipeline.md # video-canvas / video-frames / video-loop / video-set · still → seamless transparent loops│ ├─ docs/frame-interpolation.md # generative in-between (codex/grok) → take raw · auth prereqs · RIFE retire rationale│ └─ docs/seamless-video-loop.md # non-looping AI video clip → seamless loop: flow-matched cut + RIFE seam bridge│diff --git a/pyproject.toml b/pyproject.tomlindex 98d5f96..297d925 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"name = "sprite-gen"# Release discipline: keep this package metadata version synchronized with# SKILL.md's `version:` field in the same release commit.-version = "1.61.0"+version = "1.62.0"description = "Component-row pipeline for clean 2D game sprites and animation atlases"readme = "README.md"license = "Apache-2.0"