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(resample): say which places use the cell resample — the ones that scaled with LANCZOS — and drop a frequency claim no fixture backs

Soohong Kimfca8276a7691
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2259df..b774916 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the
## Unreleased - A keyed picture is scaled without a light rim or a green tint at the edge wherever the engine scales one: a row frame, a sliced sheet, a scene layer
-- **Every keyed picture the engine scales goes through the loop's resample** (`resize_cell`, now in `sprite_gen/util/resample.py`): a row frame shrunk into its cell (`extract`, `fit.resample: lanczos`, the default), the plain and original-quality twins beside a pixel-unfake frame (`.plain.png`, `orig/`), a sliced sheet's figures (`slice-sheet`) and a scene's layers (`scene-render`). Each used LANCZOS over premultiplied RGBA and drew the same lighter rim and key tint at the edge as the loop's strip did before 2.19.0. On the synthetic outlined figure (`tests/keyed_figure.py`), LANCZOS left 137 pixels at 0.2x, 543 at 0.5x, 978 at 0.75x and 7,315 at 2x with a colour none of the source pixels under them had; none are left at any of them. `fit.resample: lanczos` keeps its name and stays the smooth shrink (coverage is still LANCZOS); `nearest`, `kcentroid` and pixel-unfake frames are unchanged, and a picture at its own size is copied as it is. Colour is no longer sharpened, so a scaled scene layer with no transparency (a painted background) is a little softer than LANCZOS drew it. A tween's scale (`normalize_tween_scale`) is left on LANCZOS: it scales an opaque canvas before the key is removed, where there is no coverage to divide by. [docs/video-pipeline.md](docs/video-pipeline.md), [docs/pixel-unfake.md](docs/pixel-unfake.md), [docs/sheet-slicing.md](docs/sheet-slicing.md), [docs/scene.md](docs/scene.md).
+- **The places that scaled a keyed picture with LANCZOS now use the loop's resample** (`resize_cell`, now in `sprite_gen/util/resample.py`): a row frame shrunk into its cell (`extract`, `fit.resample: lanczos`, the default), the plain and original-quality twins beside a pixel-unfake frame (`.plain.png`, `orig/`), a sliced sheet's figures (`slice-sheet`) and a scene's layers (`scene-render`). Each used LANCZOS over premultiplied RGBA and drew the same lighter rim and key tint at the edge as the loop's strip did before 2.19.0. On the synthetic outlined figure (`tests/keyed_figure.py`), LANCZOS left 137 pixels at 0.2x, 543 at 0.5x, 978 at 0.75x and 7,315 at 2x with a colour none of the source pixels under them had; none are left at any of them. `fit.resample: lanczos` keeps its name and stays the smooth shrink (coverage is still LANCZOS); `nearest`, `kcentroid` and pixel-unfake frames are unchanged, and a picture at its own size is copied as it is. Colour is no longer sharpened, so a scaled scene layer with no transparency (a painted background) is a little softer than LANCZOS drew it. A tween's scale (`normalize_tween_scale`) is left on LANCZOS: it scales an opaque canvas before the key is removed, where there is no coverage to divide by. [docs/video-pipeline.md](docs/video-pipeline.md), [docs/pixel-unfake.md](docs/pixel-unfake.md), [docs/sheet-slicing.md](docs/sheet-slicing.md), [docs/scene.md](docs/scene.md).
## v2.19.0 - A loop's cells are scaled without a light rim or a green tint at the edge, and front and back stills keep their view
diff --git a/docs/architecture.md b/docs/architecture.md
index a86226c..fa8bae7 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -298,8 +298,8 @@ flowchart TD
5. `fit_to_cell()` — crop, aspect-preserving downscale (`resample`:
lanczos | nearest | kcentroid), `align_x`/`align_y` placement, into the
cell. `lanczos` is the smooth shrink: coverage by LANCZOS, colour mixed apart
- from it (`sprite_gen.util.resample.resize_cell`, the resample every keyed
- picture goes through), so the fitted frame has no rim or key tint at its edge
+ from it (`sprite_gen.util.resample.resize_cell`, the resample of the places
+ that scaled with LANCZOS), so the fitted frame has no rim or key tint at its edge
that the keyed frame did not have. On `fit.pixel_unfake` runs this legacy path still runs once per
frame to produce the `.plain.png` twin (§6.1); the canonical frame goes
through the pixel-unfake path instead.
diff --git a/docs/run-contract.md b/docs/run-contract.md
index e6c3438..f42c4c0 100644
--- a/docs/run-contract.md
+++ b/docs/run-contract.md
@@ -168,7 +168,7 @@ Rules the display depends on:
pixel-unfake off, so "off = original" is crisp instead of an upscaled cell blur.
S is **per-row native**: the ceil of the largest component-crop / final-content-bbox
ratio across the row's frames (bounded by `2048 // cell`), so the twin resample is a
- mild upscale — never a downscale (and, like every keyed picture, through `resize_cell`:
+ mild upscale — never a downscale (and, like the other places that scaled with LANCZOS, through `resize_cell`:
coverage and colour scaled apart, no rim or key tint added at the edge). The old fixed ×4 cap squeezed high-pitch raws
(synthetic_fixture_b down rows, ~14px pitch) ~3.5× and the "original" view stopped being the
original (maintainer, 2026-07-23). The
diff --git a/docs/sheet-slicing.md b/docs/sheet-slicing.md
index 2d8ff41..bb9ee3b 100644
--- a/docs/sheet-slicing.md
+++ b/docs/sheet-slicing.md
@@ -82,9 +82,8 @@ during the a cut-in overhaul (2026-07-09):
slightly larger body — runtime cut-in renderers assume one scale, so
asset-side height consistency wins. The figure is scaled with its
coverage and its colour taken apart (`resize_cell`,
- [video-pipeline.md](video-pipeline.md) "Cells"): a figure is usually
- brought to the target by a few percent, the scale at which LANCZOS over
- the keyed RGBA put the most key tint into the edge.
+ [video-pipeline.md](video-pipeline.md) "Cells"), so the scaled figure has no rim or key tint at its edge that
+ the sliced figure did not have.
5. **Feet on the baseline.** The main figure's lowest pixel lands on
`--baseline-y`; effects above the head never shift the feet.
6. **Fail loud on empty cells.** A cell with no subject after extraction
diff --git a/docs/video-pipeline.md b/docs/video-pipeline.md
index 0c2bcaf..8e69206 100644
--- a/docs/video-pipeline.md
+++ b/docs/video-pipeline.md
@@ -529,7 +529,7 @@ Outputs:
none, and the strands keep LANCZOS's coverage. Colour is no longer sharpened, so a 1 px line
inside the body comes out a little softer than LANCZOS drew it when a cell is enlarged. The
GIF and WebP are cut from these cells. The function lives in `sprite_gen/util/resample.py`
- and is the one resample for a keyed picture: a row frame fitted to its cell and the twin
+ and is the resample of every place that scaled a keyed picture with LANCZOS: a row frame fitted to its cell and the twin
beside a pixel-unfake frame (`extract`), a sliced sheet's figures (`slice-sheet`) and a
scene's layers (`scene-render`) go through it too.
- `<name>.gif` — `n_out` frames evenly across the cycle, 1-bit alpha, disposal 2, `loop=0`.
diff --git a/sprite_gen/util/resample.py b/sprite_gen/util/resample.py
index ef67a8a..0698b55 100644
--- a/sprite_gen/util/resample.py
+++ b/sprite_gen/util/resample.py
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
"""The one resample for an RGBA cutout: coverage and colour scaled apart.
-Every place the engine scales a keyed picture goes through `resize_cell`: a loop's cells
+The places that scaled a keyed picture with LANCZOS go through `resize_cell`: a loop's cells
(`video-loop`), a row frame fitted to its cell and the twins beside a
pixel-unfake frame (`extract`), a sliced sheet's figures (`slice-sheet`) and a scene's layers
(`scene`). docs/video-pipeline.md "Cells".