$npx -y skills add 0x0funky/agent-sprite-forge --skill video2dspriteGrok Build ONLY. Turn a 2D character still into smooth animation sprites via image_gen/image_edit base → image_to_video (6s/10s run-in-place) → ffmpeg frames → magenta chroma-key → dense sampled sprites (strip/grid/GIF). Use when the user wants video-to-sprite, motion capture fro
| 1 | # Video2dsprite (Grok Build only) |
| 2 | |
| 3 | Convert a **base 2D character image** into **dense animation sprites** using Grok Build's native video tools. |
| 4 | |
| 5 | ```text |
| 6 | base still → image_to_video (in-place motion) → extract frames → chroma key → sample/normalize → strip / grid / GIF |
| 7 | ``` |
| 8 | |
| 9 | ## Platform gate (read first) |
| 10 | |
| 11 | | Runtime | Supported? | |
| 12 | | --- | --- | |
| 13 | | **Grok Build** (xAI) | **Yes** — requires `image_gen` / `image_edit` + `image_to_video` (or `reference_to_video`) | |
| 14 | | Codex / Claude / other agents | **No** — they lack Grok video tools. Tell the user this skill is Grok Build only and offer `$generate2dsprite` instead | |
| 15 | |
| 16 | If `image_to_video` is missing from the tool list, **stop** and explain. Do not fake motion with code-drawn frames. |
| 17 | |
| 18 | This skill is an **optional denser-motion path**. It does **not** replace `$generate2dsprite`: |
| 19 | |
| 20 | | Use `$generate2dsprite` when… | Use `$video2dsprite` when… | |
| 21 | | --- | --- | |
| 22 | | Crisp pixel sheets, fixed grids, identity-critical heroes | User wants denser intermediate poses / smoother feeling loops | |
| 23 | | Attack/cast body sheets, prop packs, engine atlases | Experimenting with video-sourced run/walk/idle motion | |
| 24 | | Production default for most game sprites | User explicitly asks for video → frames → sprites | |
| 25 | |
| 26 | Video softens pixels, drifts identity, and leaves chroma fringes. Always QC; for production heroes, prefer `$generate2dsprite` unless the user wants the video look. |
| 27 | |
| 28 | ## Parameters |
| 29 | |
| 30 | Infer from the user request: |
| 31 | |
| 32 | - `subject`: character / creature description, or path to existing still |
| 33 | - `action`: `run` | `walk` | `idle` | `attack` | custom motion phrase |
| 34 | - `view`: usually `side` (side-scroller). `topdown` is harder — warn and keep camera locked |
| 35 | - `duration`: `6` (default) or `10` seconds |
| 36 | - `frame_counts`: which denser sets to export, default `8,16,24,48` |
| 37 | - `cell_size`: output sprite cell, default `128` |
| 38 | - `anchor`: `feet` (default for side locomotion) | `center` |
| 39 | - `bg`: solid `#FF00FF` (required for chroma) |
| 40 | - `name`: output slug |
| 41 | - `out_dir`: working folder (default `./sprites/video2dsprite/<name>/` or project-relative) |
| 42 | |
| 43 | ## Agent rules |
| 44 | |
| 45 | 1. **Grok-only.** Refuse on non-Grok runtimes with a short explanation + `$generate2dsprite` alternative. |
| 46 | 2. **Still → video, never text-to-video alone.** Stage frame 1 as a clean still (`image_gen` or `image_edit` from a reference). Then call `image_to_video`. |
| 47 | 3. **In-place motion.** Prompt for run/walk **in place** facing a fixed direction. No camera pan, no background scroll, no scene change. Subject stays roughly centered. |
| 48 | 4. **Solid magenta background** on the base and preserved in the video prompt (`#FF00FF` / pure magenta). Required for flood-fill chroma. |
| 49 | 5. **Do not invent art with PIL/Canvas.** Base art comes from `image_gen` / `image_edit` or a user/local still. Scripts only postprocess. |
| 50 | 6. **Do not put experimental outputs into the game** unless the user asks to integrate. |
| 51 | 7. **Prefer one locomotion cycle for game use.** Dense sample across a full 6s multi-cycle clip is fine for previews; for engine sheets, optionally re-sample a single cycle (12–16 frames) after visual QC. |
| 52 | 8. **Report absolute paths** of video, cleaned frames, strips, and preview GIFs when done. |
| 53 | |
| 54 | ## Workflow |
| 55 | |
| 56 | ### 1. Plan |
| 57 | |
| 58 | Pick the smallest useful run: |
| 59 | |
| 60 | - Side-view run/walk loop → this skill |
| 61 | - Multi-action hero kit → still use `$generate2dsprite` per action; only use video for locomotion if requested |
| 62 | - FX / projectile / prop packs → `$generate2dsprite`, not video |
| 63 | |
| 64 | Create: |
| 65 | |
| 66 | ```text |
| 67 | <out_dir>/ |
| 68 | base/ |
| 69 | video/ |
| 70 | frames-raw/ |
| 71 | frames-clean/ |
| 72 | sprite/ # default 8-frame set + denser x16/x24/x48 |
| 73 | prompt-used.txt |
| 74 | pipeline-meta.json |
| 75 | README.txt |
| 76 | ``` |
| 77 | |
| 78 | ### 2. Build the base still |
| 79 | |
| 80 | Options: |
| 81 | |
| 82 | - **A. Existing sprite:** open with image tools / read image, composite onto solid `#FF00FF` if needed |
| 83 | - **B. New character:** `image_gen` with solid magenta background, full body, side view, centered |
| 84 | - **C. Match reference:** `image_edit` from user reference onto magenta, preserve identity |
| 85 | |
| 86 | Base requirements: |
| 87 | |
| 88 | - Full body visible, generous magenta margin |
| 89 | - Side view for run/walk (profile or 3/4 side), feet near bottom third |
| 90 | - Same art style as the rest of the project when a reference exists |
| 91 | - No text, UI, watermark, or second character |
| 92 | |
| 93 | Save as `<out_dir>/base/<name>-base.png`. |
| 94 | |
| 95 | Write the exact image prompt into `prompt-used.txt`. |
| 96 | |
| 97 | ### 3. Animate with `image_to_video` |
| 98 | |
| 99 | Call Grok `image_to_video`: |
| 100 | |
| 101 | - `image`: path to the base still |
| 102 | - `duration`: `6` (default) or `10 |