Skip to content

Import a sprite sheet

Récit draws its own sprites from data: a ```pixel grid, or a seeded recipe ::pixel{gen=sprite seed=…}. Anything richer, real poses, layers, hand shading, is made in a drawing tool outside Récit and imported as a file. Récit never imports the code of those tools and never calls an image model: it reads the sheet, checks its size when it plays it and keeps where it came from.

The target: codex-pet-v1

A character sheet has one layout in v1, codex-pet-v1: 1536 × 1872 pixels, 8 columns by 9 rows, cells of 192 × 208, unused cells transparent. One pose per row, in this order: idle (6 frames), running-right (8), running-left (8), waving (4), jumping (5), failed (8), waiting (6), running (6), review (6). A sheet of any other size is an error ("unknown layout"), never a guess: the commands that play the sheet (recit build, recit render, and recit validate on a motion story) stop on it.

To start from a placeholder rather than an empty canvas, generate one and retouch it:

TerminalShell
recit pixel sheet figure.json -o figure.png

The source is either a recipe in JSON (figure.json: { "gen": "sprite", "seed": "lorem" }, what the workshop's "Copy JSON" gives for an untouched seed), or a Markdown file (figure.md) whose first ```pixel fence or ::pixel{gen=sprite …} directive is the sprite. Any other JSON, a story twin or a pixel block, is refused: for a retouched grid, paste the workshop's "Copy Markdown" into a .md file. The command writes figure.png.json beside the sheet, its provenance, with origin: "code".

From a drawing tool

ToolHow to exportLicence of the tool
PiskelExport → PNG → spritesheet, 8 columns, frame size 192 × 208; one row per pose, in the order aboveApache-2.0, a web app: nothing is copied
Aseprite / LibreSpriteFile → Export Sprite Sheet, by rows, one tag per pose named after its row; keep the JSON, then recit pixel import (below)proprietary / GPL-2.0: external tools only
claude-pxlrender its .px.ts to a PNG sheet, then lay the frames out as aboveMIT, no release yet: Récit does not depend on it
LPC generatorexport the PNG and the credits CSV; re-lay the frames into codex-pet-v1code GPL-3.0, art per file (see below)

From Aseprite's JSON

Aseprite lays its frames out its own way; recit pixel import lays them out again in codex-pet-v1, without redrawing a pixel. In File → Export Sprite Sheet, tick « JSON Data » (Array or Hash) and « Tags », leave « Trim Sprite » and « Trim Cels » unchecked (a trimmed frame is centred on its own size and the pose jumps; the import warns), and name each tag after a pose (idle, running-right…, case aside):

TerminalShell
recit pixel import figure.json -o figure.png --author "Lorem Ipsum" --license CC-BY-4.0

The PNG named by meta.image is read beside the JSON. Each tag fills the row of its pose, in its direction (forward, reverse, pingpong); a row always plays the layout's count of frames, so extra frames are dropped and a short tag repeats its last one, both with a warning. A pose with no tag keeps a transparent row; a tag that names no pose, or two tags that name the same pose (the last one wins), is a warning; no pose at all is an error, and so is an output that would overwrite the JSON or its PNG. Frames are scaled by the largest whole factor that fits the 192 × 208 cell, centred and pixelated; a larger frame is shrunk to fit, never cropped. The durations are those of the layout, not Aseprite's. The command writes figure.png.json beside the sheet with origin: "human", the PNG in references, and the author and license you give.

Then, for the sheet figure.webp:

  1. Copy it next to the bible entry of the character (cast/figure/figure.webp).
  2. Write its provenance figure.webp.json (kind: "asset"): origin is human for a drawing, mixed for a retouched generated sheet, ai for a model's output, code for a sheet written by recit pixel sheet. Give author and license.
  3. Add ::sheet{src=./figure.webp layout=codex-pet-v1} to the entry.
  4. Check that the sheet is still pixel art: recit pixel grid figure.webp. A tool that resized the sheet with smoothing, or exported it anti-aliased, leaves colours between the art pixels; the command finds the true grid of each drawn cell (the idea of pixeldetector), requires one whole scale of at least ×2 for all of them, and names every cell that is off its grid. Each cell may sit at its own offset. --tolerance 2 accepts colours one or two steps apart (a lossy WebP), --min-scale raises the bar. It exits with 1 when the sheet is not a true grid.
  5. Run recit validate on the story that names the bible in cast:: an image next to the bible without a provenance file is a warning, an error with --strict. The size of the layout is checked only where the sheet is played (a motion story, recit build, recit render), and the license and author of the provenance are yours to fill in: nothing checks them yet.

Licences

The art of a sheet is not the code of the tool that drew it: each has its own terms.

CaseWhat Récit does
GPL code (LPC generator, lpc-spritesheet-mcp, LibreSprite)never imported nor copied into a package: a link or an external tool only
LPC art (CC-BY-SA, GPL, CC-BY, OGA-BY)credit per file: copy the authors and licences of the exported credits CSV into the provenance (author, license) and keep the CSV next to the sheet; Récit does not read the CSV yet, so nothing refuses a sheet without credits; CC-BY-SA asks the derived sheet (and, depending on use, the story) to be shared alike; no LPC asset in the examples
CC BY 4.0 arta visible credit is required; avoided by default
Art under its own terms (avataaars, bottts, Multiavatar)excluded
Non-commercial licencesneither a dependency nor a copy
No LICENSE fileall rights reserved: read only
Apache-2.0 (hatch-pet, Piskel)compatible; reusing its text or code needs a line in NOTICE
AI outputthe provider's terms apply, and the provenance says aiGenerated: true

The examples of Récit stay Lorem Ipsum: abstract, generated sprites, never third-party art.

Last modified on