Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

docs(no-repeat): asset-tools "Frames shown again" (the speck floor never above half a frame's largest part, a box that holds nothing, `steps` and `inspected`, a reading of nothing exits 2), video.md's clip of the canvas alone, and the CHANGELOG's Unreleased (v4.0.0) line

Soohong Kima65a4214d835
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 593f827..1558035 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,6 +40,7 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
- **Fixed: `scene-render` and `scene-inspect` read a strip's cells at `delay_ms`, rounded to hundredths, so a scene frame on a cell boundary showed the cell before it (`spec.assets.frame_seconds`, `SNAP_MS`).** `delay_ms` is 41.67 ms for 24 fps. Where the rounded delay is longer than the exact one (24, 60 and 15 fps strips), a 24 fps strip in a 24 fps scene showed its first cell twice, and in a 20 fps scene frames 5, 10 and 15 showed cells 5, 11 and 17 where 0.25 s x 24 = 6, 12 and 18 are right. The cells are now read at the strip's `fps` where its sidecar gives one, and a strip from before (no `fps`) whose `delay_ms` is within 0.01 ms of a whole rate is read at that whole rate. Those boundary frames change; `--fill-held off` does not undo this. Strips at 25, 20, 30, 12 and 48 fps render byte for byte as before (pinned).
- **New: `scene-render --fill-held auto` gives a layer cut from a filmed clip at the scene's times; the report gains `inspection.repeats` and `fill_held`; new `scene-render --between-cache DIR`.** By default, a layer whose asset is a cut of a filmed clip (a `video-loop` or `video-stop` strip, its sidecar names `source_cut`) and would show a cell again at the scene's frames (a 24 fps cut in a 60 fps scene, a `playback_rate` under 1) is given at the scene's times: each frame the cell its time falls on, or RIFE's frame between the two cells either side at its own time, judged as `video-loop` judges a frame made for a held cell. Held on purpose stays held: before the layer's start, a one-shot's end and `hold_last`, a run its strip lists in `holds`, and every layer that is not a video cut (a still, an atlas row, a pixel drawing), which holds its cells as drawn. A layer that shows no cell again keeps its cells as its timing picks them (at the strip's exact rate) and makes no frame; every strip's cells are now read at its exact rate, so a frame on a cell boundary of a 24, 60 or 15 fps strip can change (a 24 fps strip in a 20 fps scene showed frames 5, 10 and 15 as cells 5, 11 and 17 before, and now as cells 6, 12 and 18); strips at 25, 20, 30, 12 and 48 fps render byte for byte as before (pinned in tests). A frame between refused shows the nearer cell again and is named; with no RIFE installed the cells are given as cut and a warning names the frames and the install command; a RIFE that fails stops the render, naming `--fill-held off`. `--fill-held off` gives every layer's cells as its timing picks them. `inspection.repeats` is each layer's table of scene frames that show the cell the frame before shows: each run, the cell, whether it is held on purpose and why; `fill_held` is in the report. `--between-cache DIR` keeps the frames made between cells across renders, under the bytes of the two cells, the time and the RIFE that made them, and takes them from there on the next render; the report's `between_cache` counts hits and misses. Nothing is kept without it.
- **New: `sprite-gen inspect-holds` (qa) reads a delivery for frames that show a figure's picture again and compares them with hold lists (`--holds`, `--gate`, `--key`, `--box`, `--log`, `--log-figure`).** It reads frames with alpha, a keyed clip with `--key`, a figure's box with `--box`, or a renderer's log of cells with `--log` and `--log-figure`, with the same rule as `held_fill.same_steps` on the figure's pixels. It compares them with hold lists (`--holds`, a strip's `holds`, the list form a renderer uses) and reports listed and unlisted holds; `--gate` exits 1 where any hold is on no list. A render that draws a figure at a new scale or sub-pixel place on every frame is read by its `--log`. Its full documentation is `docs/asset-tools.md` "Frames shown again".
+- **Fixed: `inspect-holds` reads a frame's largest part as a figure however few pixels it has, reads nothing in a `--box` that holds no pixel, exits 2 where no frame was read against the frame before, and reports `steps` and `inspected`; the Grok clip reading of `video`, `video-extend`, `video-edit` and `video-resume` does not read a clip whose every frame is the canvas alone.** A part is a speck, and is not read, where it holds under 2 % of the pixels of the frame's largest part, or under 64 px; the 64 px floor applied to every part, the frame's largest included, so a frame whose only figure had under 64 px read no figure at all: a 7 x 9 block (63 px) shown on three identical frames of a 24 x 24 clear canvas read an empty table and `--gate` exited 0 with nothing on stderr, although its frames 1 and 2 show the picture of the frame before, where an 8 x 8 block (64 px) read 2 unlisted holds and `--gate` exited 1. Now the 64 px floor is never more than half the frame's largest part, so the largest part is always a figure and a part half its size or more is a figure too (two small figures in one frame are both read); both blocks read 2 unlisted holds (frames 1-2) and `--gate` exits 1, and where a frame's largest part has 128 px or more the rule is exactly what it was. Dots of 1, 2 and 3 px far from the figure, the same on every frame, are still not read. With `--box`, two frames whose box held no pixel with alpha over 8 (clear there, or past the frame's edge) read as one picture shown again, so a box over clear frames, or past the frame's edge, read a hold on every frame after the first; now such a frame shows no figure there and two such frames are no picture shown again. The report gains each figure's `steps` (its frames read against the frame before; on a loop read across its wrap, the wrap is one step) and `inspected` (the number of figures read on one step or more); the other fields are unchanged, exit 0, 1 and 2 keep their meanings, and a reading that reads no frame against the frame before is now one of the errors (exit 2). A reading that reads no frame against the frame before (no frame: an empty folder, `--frames` that starts past the last frame of a folder, a video, a strip or a log, a log of no line; no figure on any frame: clear frames, frames whose every pixel has alpha 8 or under, a key that leaves nothing, a box that holds nothing, a log whose `--log-figure` keys name no cell on any line; no figure shown on two frames in a row, for example one frame) is an error: it exits 2 with or without `--gate`, its report is still printed on stdout and written to `--report` with `inspected` 0, and one line on stderr says why. Before, most of these passed `--gate` (exit 0, an empty table, nothing on stderr); an empty folder and a log of no line exited 2 but printed no report; a strip given `--frames` past its last cell was refused with the wrong reason (as opaque frames); a box over nothing failed the gate on frames that showed nothing. In Python, `inspect(...)` and `read(...)` in `sprite_gen.qa.holds` raise `NothingRead`, a `ValueError` whose `report` attribute is the report, with `inspected` 0. The Grok clip reading of `video`, `video-extend`, `video-edit` and `video-resume` read a clip whose every frame is the canvas alone (no pixel left once the canvas colour is taken out) as one run of all its frames, recorded as a hold the motion means, and said nothing; now such a clip is not read, its report's `held` is `read` false with `frames`, `background` and a `why`, the warning line says its frames were not read for a picture shown again, and the clip is still published.
- **Python callers.** `held_fill`: new `wrap_same`, `KEEPS`, `intended`, `again`, `strip_holds`; `premultiplied` (was `_premultiplied`); `fill(..., wrap=, drawn_on=)`; `reading(..., wrap=)`. `loop`: new `cut_again`; `fill_cut`, `fill_lines`, `out_fps_lines` (were `_fill_held`, `_fill_lines`, `_out_fps_lines`). `align`: new `filled`, `unfilled_source`, `CUT_AGAIN_DIR`; `align_set(..., fill_held=, out_fps=)`. `batch`: new `held_summary`, `loop_summary`, `cut_again_unaligned`; `align_gaits(..., fill_held=, out_fps=)`. `spec.assets`: new `frame_seconds`, `SNAP_MS`, `FrameSequence.index_at`. `scene.render.Renderer(..., fill_held=, interpolate=, between_cache=)`. New module `sprite_gen.qa.holds`. `stop.make_stop(..., fill_held=, interpolate=)`.
- **Tests: `tests/video/test_no_repeat_default.py`, `tests/scene/test_scene_fill_held.py`, `tests/qa/test_inspect_holds.py`, `tests/gen/test_video_held.py`, `tests/video/test_face_bake_held.py` (new); `tests/video/test_held_fill.py`, `tests/video/test_stop.py`, `tests/video/test_face_layer.py`, `tests/video/test_root_motion.py`, `tests/video/test_loop_prop_seam_held.py`, `tests/video/test_motion_anchor.py` (changed).** `test_no_repeat_default.py` covers a loop's last cells, a cut one cell too long, the read again after the repairs, the strip's `holds`, `cut_args` and `cut_again`, the lifetime warning, the alignment's end fill, its cut again with the fill off and its refusal, `--out-fps` once aligned, a set with no held cell aligned as before, and `video-set` cutting aligned items as filmed and cutting again the ones no alignment took. `test_held_fill.py`'s wrap tests: a run at a loop's wrap is made, a last cell showing the first again is made and the first kept, a hold across the wrap longer than three cells kept whole, a cut played once reads no wrap. `test_stop.py`: the stop fills by default; with no held cell and with `--fill-held off` it is the pictures pinned before. `test_face_layer.py`, `test_root_motion.py` and `test_loop_prop_seam_held.py`: the strip metadata grows `fps` and `holds`, the old pins otherwise unchanged. `test_motion_anchor.py`: its anchored cells 5 to 7 differ by one pixel, so the test cuts with `--fill-held off` to check the anchor's own cells. No-repeat outputs keep their pictures: the six cuts pinned before, a stop with no held cell, a set aligned with no held cell (pinned on commit 4f5ccd5) and scenes at 25, 20, 30, 12 and 48 fps.
diff --git a/docs/asset-tools.md b/docs/asset-tools.md
index 24f0c51..802e12c 100644
--- a/docs/asset-tools.md
+++ b/docs/asset-tools.md
@@ -134,6 +134,8 @@ The figure is read one of four ways:
| `--box x,y,w,h` | that box of each frame, in place | a figure over a background that does not move |
| `--log FILE` with `--log-figure KEY` | the cell each figure shows: one JSON object a line, one line a frame from 0; `KEY` holds a cell (a string or a number, an object as its values joined by spaces, null where not shown) or a list of them (`figures` gives `figure0`, `figure1`, ...) | a renderer that logs its cells; exact, no pixel read |
+Read by alpha, or by `--key`, a figure is the solid pixels of a frame (alpha over 8, on 0..255) gathered within 6 px of each other; each such group is a part of the frame. A part is a speck, and is not read, where it holds under 2 % of the pixels of the frame's largest part, or under 64 px; the 64 px floor is never more than half the frame's largest part. So the largest part of a frame is always a figure however few pixels it has, and a part half the largest part's size or more is a figure too: two small figures in one frame are both read. Dots of 1, 2 and 3 px far from the figure, the same on every frame, are not read, beside a large figure or beside a 63 px one. With `--box`, a frame whose box holds no pixel with alpha over 8 (the frame is clear there, or the box lies past the frame's edge) shows no figure there; two such frames are no picture shown again.
+
An opaque frame whose background moves is not read: its background changes more pixels from one frame to the next than a figure's step does, so a held picture and a moving one cannot be told apart. Opaque frames given with none of `--key`, `--box` or `--log` are refused (exit 2). Read such a delivery by its figure layer, a key, or a log.
A renderer that draws a figure at a new scale, turn or sub-pixel place on every frame draws a held picture afresh each time: the frame changes more of the figure's pixels than the rule below allows and is not read as a hold. Read such a render by its log.
@@ -142,6 +144,12 @@ Two pictures are one picture by the rule a cut's held cells are read by ([loop-r
`--holds FILE` names the holds a delivery means, in the format a holds list is written in: `{"holds": [{"scene", "figure", "from", "to", "reason"}]}`, frames `from` to `to` inclusive. A folder reads every `*.holds.json` under it, and `--holds` repeats. `scene` and `figure` may be left out, for a list of one video or of every figure; a list that names scenes is read for the one `--scene` names (without `--scene` it is refused). A hold without a reason, or whose `from` is after its `to`, refuses the list. A strip's own `holds` (the holds its cut means, `motion-hold`, `drawn`, `opening`, `closing`) are listed with it, and a strip that loops is read across its wrap too (its first cell against its last: a hold at frame 0).
-The report (stdout, and `--report PATH`) gives each figure's `frames`, `holds`, `listed`, `unlisted`, `unlistedRuns` and `listedRuns`, each run `from`, `to` and `drawings` (the cell a log names, or the frame the picture was first shown on), a listed run its `reason`, and `unlisted` over every figure; `read_by`, `first_frame`, `wrap`, the lists read and the rule's numbers. `--gate` exits 1 where any hold is on no list, else 0; without it the command exits 0 whatever it finds, and an unlisted hold is a line on stderr. Errors exit 2.
+The report (stdout, and `--report PATH`) gives each figure's `frames`, `steps` (its frames read against the frame before; on a loop read across its wrap, the wrap is one step), `holds`, `listed`, `unlisted`, `unlistedRuns` and `listedRuns`, each run `from`, `to` and `drawings` (the cell a log names, or the frame the picture was first shown on), a listed run its `reason`, `unlisted` over every figure and `inspected` (the number of figures read on one step or more); `read_by`, `first_frame`, `wrap`, the lists read and the rule's numbers. `--gate` exits 1 where any hold is on no list, else 0; without it the command exits 0 whatever holds it finds, and an unlisted hold is a line on stderr. Errors exit 2.
+
+A reading that reads no frame against the frame before is an error, not a reading that found no hold: it exits 2, with or without `--gate`. Its report is still printed on stdout and written to `--report`, with `inspected` 0, and one line on stderr says why. This is the case where there is no frame (an empty folder; `--frames` that starts past the last frame of a folder, a video, a strip or a log; a log of no line), where no frame shows a figure (clear frames; frames whose every pixel has alpha 8 or under; a key that leaves nothing; a box that holds nothing; a log whose `--log-figure` keys name no cell on any line), or where no figure is shown on two frames in a row (one frame, for example). For three clear frames the line is:
+
+```
+inspect-holds: no frame was read against the frame before: no figure on frames 0-2 (no pixel with alpha over 8)
+```
-Python API: `inspect(figures, *, first=0, start=None, listed=(), wrap=False, same=None)`, `alpha_figures(frames)`, `log_figures(path, keys)`, `same_figure(a, b)` and `read(...)` in `sprite_gen.qa.holds`.
+Python API: `inspect(figures, *, first=0, start=None, listed=(), wrap=False, same=None)`, `alpha_figures(frames)`, `log_figures(path, keys)`, `same_figure(a, b)` and `read(...)` in `sprite_gen.qa.holds`. `inspect(...)` and `read(...)` raise `NothingRead` where nothing was read; `NothingRead` is a `ValueError`, and its `report` attribute is the report, with `inspected` 0.
diff --git a/docs/video.md b/docs/video.md
index c6589bc..73291bd 100644
--- a/docs/video.md
+++ b/docs/video.md
@@ -146,6 +146,11 @@ closing pose and a run longer than a drawing on threes (`hold_max`, 3) are recor
a `why` and not warned of — a still at either end, or a hold the motion means. With no
ffmpeg, or a file ffmpeg cannot read, `held` is `{"read": false, "why": …}` and the run
says its frames were not read; the clip is still published.
+A clip whose every frame is the canvas alone (no pixel left once the canvas colour is
+taken out) is not read either: `held` is `read` false, with `frames`, `background` and a
+`why` (for an 8-frame clip: `no frame of the 8 shows a subject: every pixel is within 0.12
+of the colour it is filmed on (...)`), and the warning line says its frames were not read
+for a picture shown again; the clip is still published.
### An unfinished generation