# game-sprite-cutout

Turn a generated image on a flat background into a clean game sprite: background removed, trimmed, optional pixel-art downscale and palette, padded to a power of two

- **Space:** game-assets-and-ai-public (https://github.com/Tech-Realm/space-game-assets-and-ai-public/tree/main/game-sprite-cutout)
- **Level:** L1 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3, Pillow
- **Routes:** mflux, local-pillow, codex-image; checks: 2
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use game-assets-and-ai-public/game-sprite-cutout` or MCP `get_pack game-assets-and-ai-public/game-sprite-cutout`
- **Files:** CHANGELOG.md, code/make_fixture.py, code/sprite_cutout.py, code/verify_sprite.py, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/results.json, pack.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

## Goal
A transparent PNG sprite ready for an atlas, from an AI image prompted onto a flat key colour.

## Steps
1. Generate on the free route with a flat key background: `~/gen-image.sh "<subject>, game sprite, centered, flat magenta #FF00FF background" raw.png`.
2. Cut out: `python3 code/sprite_cutout.py raw.png sprite.png --key auto --tol 40` (flood fill from the corners, so key-coloured pixels inside the subject survive).
3. Pixel art: add `--pixel 64 --colors 16`.
4. Pack many sprites with `sprite-atlas-packer`.

## Edge cases
- Soft shadows on the background leave a halo: raise --tol or ask for 'no shadow' in the prompt.
- Hair/fur edges: key-colour fringes; `--despill` pulls key colour out of edge pixels.

## Don'ts
- Don't use a background colour that appears in the subject.
- Don't ship sprites of characters/brands we don't own.



---

Canonical URL: https://logicpacks.io/packs/game-assets-and-ai-public/game-sprite-cutout

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
