Checks
Lint a sprite, verify a whole export folder and its animations, render a Godot scene headless, and use the exit codes in CI.
Mode 8 has two check commands. mode8 lint checks one sprite: transparency, size, palette, colors, shape and, on request, the measured rules of the quality bar. mode8 verify checks a whole folder: every PNG in it, the stability of every animation, and optionally a Godot scene rendered headless. Both print a verdict and exit 1 when a check fails, so a script or a CI job can stop on it.
Make a starter project to follow along:
mode8 init my-game --template platformer
cd my-gameLint a sprite#
$ mode8 lint assets/hero/master.png
✓ assets/hero/master.png passes lint
64x72 · 11 colors
palette nes_master_gothic from mode8.toml
Next:
mode8 lint assets/hero/master.png --quality # also check noise, jaggies, rampsInside a project the palette comes from mode8.toml; pass --palette to check against another. Lint fails a sprite when:
- a pixel is semi-transparent (every pixel is either fully opaque or fully transparent);
- a color is not in the palette;
- it is not the
--size WxHyou expect, or has more than--max-colors Ncolors; - stray pixels sit in tiny islands apart from the sprite.
Two optional checks are about pure black: --check-interior-black fails #000000 inside the body, and --no-allow-outline-black fails it even on the outline.
Here the hero is checked against the 4-color Game Boy palette it was not drawn in, so it fails, and the command exits 1:
$ mode8 lint assets/hero/master.png --palette gameboy_dmg
✗ assets/hero/master.png fails lint
64x72 · 11 colors
✗ 11 off-palette colors (#101834, #2f2d44, #450918, #4a4e67, #5a3526, #6b748b,
#86101f, #939fb1), 1888 px
Next:
mode8 lint assets/hero/master.png --palette gameboy_dmg --fix --out assets/hero/master_fixed.png # repair alpha, islands, palette--fix repairs what lint can: it makes every pixel opaque or transparent, removes stray islands and snaps every color to the nearest palette color (--metric redmean, the default, or oklab). --out writes the repaired sprite elsewhere instead of overwriting it:
$ mode8 lint assets/hero/master.png --palette gameboy_dmg --fix --out hero_gb.png
✓ hero_gb.png passes lint
64x72 · 4 colors
fixed: palette snapped
Next:
mode8 lint hero_gb.png --quality # also check noise, jaggies, ramps
The pose#
--draft compares the silhouette with the draft the sprite was made from, and reports how well they match as pose_match, from 0 to 1. It is advice only, unless --min-pose-match R makes it a gate:
$ mode8 lint assets/hero/master.png --draft assets/hero/draft.png
✓ assets/hero/master.png passes lint
64x72 · 11 colors · pose match 0.80 (advisory)
palette nes_master_gothic from mode8.toml
Next:
mode8 lint assets/hero/master.png --quality # also check noise, jaggies, rampsThe quality bar#
--art-type adds the measured rules of the quality bar for that kind of art (sprite, topdown, icon, isometric, portrait, scene, tile): a clean pixel grid, no noise or confetti, a color budget, no leftover background or frame, no double outline, a subject that fills its canvas, and more. Each failure names the rule and the quality-bar item it breaks.
A render pixelized from a concept painting shows two of them. With its background kept, it fails on the frame:
$ mode8 pixelize ~/Downloads/knight-render.webp --size 64x72 --out knight.png
✓ Pixelized → knight.png (64x72, 9 colors)
art 204x232 px on a 4.7 px grid, reduced 3.222x
palette fit 0.053 (fair) · metric oklab
palette nes_master_gothic from mode8.toml
Next:
mode8 lint knight.png --quality$ mode8 lint knight.png --art-type sprite
✗ knight.png fails lint
64x72 · 9 colors · sprite quality bar
palette nes_master_gothic from mode8.toml
✗ flat or crushed shading: value structure: a color group covering 21% of the
subject has only 1 value step(s); 48% of the subject is near-black: flat or
crushed shading (P5)
✗ has a frame or kept background: the background was kept on top, bottom,
left, right (P9)
Next:
mode8 lint knight.png --fix --out knight_fixed.png # repair alpha, islands, paletteKeying the background fixes that, and the next rule speaks up: the knight does not fill its canvas.
$ mode8 pixelize ~/Downloads/knight-render.webp --size 64x72 --bg transparent --out knight.png
✓ Pixelized → knight.png (64x72, 9 colors)
art 204x232 px on a 4.7 px grid, reduced 3.222x
palette fit 0.038 (fair) · background #8a7664 keyed · metric oklab
palette nes_master_gothic from mode8.toml
Next:
mode8 lint knight.png --quality$ mode8 lint knight.png --art-type sprite
✗ knight.png fails lint
64x72 · 9 colors · sprite quality bar
palette nes_master_gothic from mode8.toml
✗ flat or crushed shading: value structure: 48% of the subject is near-black:
flat or crushed shading (P5)
✗ subject doesn't fill the canvas: the subject leaves 5 px on its tighter axis
and floats 3 px above the bottom (P10)
Next:
mode8 lint knight.png --fix --out knight_fixed.png # repair alpha, islands, paletteThese are the same rules mode8 gen uses to choose between candidates. --dither-ok skips the dither rule for art that uses ordered dither on purpose.
Advisory checks#
--quality adds three craft checks that never fail a sprite on their own: orphan pixels (single pixels that do not belong to a shape), jaggies (uneven steps along a line) and ramp harmony (shades of a color that do not form a clean ramp). It also gives a score out of 10, which is experimental: its weighting may change in any release.
$ mode8 lint assets/hero/master.png --quality
✓ assets/hero/master.png passes lint
64x72 · 11 colors · quality 8.2/10
palette nes_master_gothic from mode8.toml--quality-strict turns their warnings into failures, and --quality-rules orphan_pixels,jaggies picks some of them.
Verify a folder#
mode8 verify --assets-dir DIR lints every PNG under a folder, as a project's assets or an export folder:
$ mode8 verify --assets-dir assets
✓ 91 assets checked: all good--exclude skips files by name pattern, such as review sheets that are not game art. --palette and --check-interior-black work as in lint.
Animation stability#
--check-anim also treats every folder of two or more frames as one animation and measures whether it holds still where it should: the feet stay on the idle frame's ground line, and the outline does not jitter in size or slide sideways from frame to frame.
$ mode8 verify --assets-dir assets/hero --check-anim
✓ 17 assets checked: all good
1 animation checked, 1 stable (feet 4 px, size 8 px, scaled to the frame height)The limits grow with the frame height (here 4 px for the feet and 8 px for size, for a 72 px tall knight). Frames that leave the ground on purpose, such as jump and hurt, are only checked for sideways drift, and poses that change the silhouette, such as attack, are not compared by width. The JSON report lists every check it left out, and why, under skipped_checks, so nothing is skipped silently.
--max-foot-drift PX and --max-bbox-jitter PX set your own limits. Tight limits fail, and the report says by how much and which offset would fix it:
$ mode8 verify --assets-dir assets/hero --check-anim --max-foot-drift 0 --max-bbox-jitter 1
✗ 17 assets checked: problems found
1 animation checked, 0 stable (feet 0 px, size 1 px)
✗ animation frames: bbox size changes by [+2, -2]px (max 1)mode8 anim writes its frames as loose PNGs in one folder; check them with --include-root, which treats the PNGs directly in --assets-dir as one animation.
Render a Godot scene#
With --godot-project, verify also opens a Godot 4 project headless, renders a scene and saves the frame as render.png in a hidden folder of the project (the report prints the path):
mode8 verify --godot-project godot --render-scene res://main.tscn --render-frame 3
--render-golden PNG compares the render with a frame you saved, and fails on any different pixel unless --render-max-diff PX allows some. It needs Godot 4 (--godot-bin or GODOT_BIN says where). Godot has more.
In CI#
Every check prints its full report as JSON when its output goes to a file or a pipe, and the exit code says what happened: 0 everything passed, 1 a check failed, 2 the command itself was wrong (a typo, a missing folder), 3 something outside Mode 8 failed. A CI step needs nothing more than:
mode8 verify --assets-dir assets --check-anim > verify.jsonThe job fails when the command exits non-zero, and verify.json holds the details. Skill and scripts covers the JSON reports.
Next#
- Exporting: export what you checked.
- Sprites: how
genuses the quality bar to rank candidates. - Troubleshooting: every error and what to do.