sprite_sheet_slice — GFX2D sprite op

Data kinds: rgbasprites

Call: import gfx2d; gfx2d.sprite_sheet_slice(sheet, tile_height, tile_width, margin=0, spacing=0, count=None) (or opsgfx2d.get("sprite_sheet_slice"))

Usage

Cut a sprite atlas into a list of equal `rgba` frames, row-major.

`margin is the border around the whole sheet, spacing` the gap between

neighbouring cells — the two numbers that every atlas exporter writes and

that every hand-rolled slicer gets wrong by one.

Returns a `list of (tile_height, tile_width, 4)` arrays. With

`margin=spacing=0 it is the exact inverse of :func:tilemap_render`.

Raises ValueError: a sheet that does not contain a whole number of cells

(a partial cell means the margin/spacing are wrong, and silently dropping it

hides that), a `count` larger than the grid, more than

:data:MAX_SPRITES cells.

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

gfx2d_scenepy -3.11 examples/gfx2d_scene.py

Ops the type connects to (they accept sprites as input)

tilemap_render · parallax_layers

Same category (sprite)

sprite_synthesize · sprite_blit · sprite_transform · nine_slice


*Provenance: gfx2d.py — GFX2D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.