agentleFS
Fable-ForgeFable-Forge/sprite-atlas-slicer/SKILL.md

sprite-atlas-slicer

Skill0 starsChanged 2 months agoMITView on GitHub

Use when splitting transparent PNG sprite sheets, sprite atlases, game UI atlases, imagegen-generated asset sheets, 图集, 切图, or 散图 into individual cropped PNG sprites for game engines.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. Fable-Forge/fableforge-agent-skills★ 1100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill to turn a transparent PNG atlas into separate game-ready PNG files.

    line 17
  2. Very specific:

    Run scripts/slice_sprite_atlas.py on the transparent atlas.

    line 22
  3. Very specific:

    If auto slicing is imperfect, create or edit a boxes JSON and rerun with --boxes.

    line 24
  4. Distinctive:

    Use manual boxes when sprites sit too close together:

    line 38
  5. Distinctive:

    Before claiming completion, verify:

    line 76
  6. Very specific:

    Do not call imagegen to cut an already generated atlas into individual files.

    line 86
  7. Distinctive:

    Do not crop by the black preview background.

    line 87
  8. Very specific:

    Do not trust auto slicing when sprites touch or sit very close.

    line 88
  9. Very specific:

    When a crop still contains neighboring fragments, add clear rectangles or keep_largest in the boxes JSON.

    line 89
  10. Very specific:

    Do not put outputs directly into a Cocos assets/ folder unless the user wants import metadata created.

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Sprite Atlas Slicer

全局协作约定

  • 编码、审查、重构或修 bug 时,可显式触发 karpathy-guidelines:先说明假设和取舍,保持改动外科式,定义可验证成功标准。
  • 汇报长日志、长文档、工具输出、agent 工作或调试证据时,可显式触发 reporting-discipline:先给结论、关键证据、风险和下一步,不默认粘贴大段原文。
  • 常用触发语:use karpathy-guidelines and reporting-discipline,或“用 karpathy 打底,并按 reporting discipline 汇报”。

Overview

Use this skill to turn a transparent PNG atlas into separate game-ready PNG files. Prefer deterministic pixel slicing over imagegen for this step; generation is for making or editing art, while slicing should preserve the existing pixels.

Workflow

  1. Confirm the input is a transparent PNG atlas. If the source has a flat chroma-key background, remove it first with the imagegen skill's chroma-key helper.
  2. Run scripts/slice_sprite_atlas.py on the transparent atlas.
  3. Inspect _preview_contact_sheet.png for obvious issues: adjacent fragments, missing text/icon pieces, over-cropped edges, or tiny noise sprites.
  4. If auto slicing is imperfect, create or edit a boxes JSON and rerun with --boxes.
  5. Deliver the output directory, manifest.json, _preview_contact_sheet.png, and zip archive if requested.

Quick Commands

Auto slice a well-spaced transparent atlas:

python scripts/slice_sprite_atlas.py \
  --input /path/to/atlas.png \
  --out-dir /path/to/slices \
  --zip /path/to/slices.zip

Use manual boxes when sprites sit too close together:

python scripts/slice_sprite_atlas.py \
  --input /path/to/atlas.png \
  --out-dir /path/to/slices \
  --boxes /path/to/boxes.json \
  --zip /path/to/slices.zip

The boxes file can be either a list or an object with an items list:

[
  { "name": "button_build", "box": [1005, 750, 1133, 897] },
  {
    "name": "aircraft_passenger_plane",
    "box": [620, 474, 953, 695],
    "clear": [[0, 0, 118, 92]],
    "keep_largest": false
  }
]

clear rectangles are local to the sprite box. Use keep_largest: true when a sprite has one main alpha component plus detached noise.

Defaults

  • Alpha threshold: 8
  • Output padding: 2px
  • Auto grouping dilation: 8px
  • Minimum component area: 100px
  • Output names: 001_<name>.png

Adjust --dilate down when separate sprites merge together. Adjust it up when one sprite splits into pieces such as dashed outlines, text, or detached icon badges.

Validation

Before claiming completion, verify:

python scripts/slice_sprite_atlas.py --input /path/to/atlas.png --out-dir /tmp/slices --zip /tmp/slices.zip

Then inspect the preview and confirm every sprite PNG is RGBA and non-empty. The script writes a manifest with source boxes and output sizes for review.

Common Mistakes

  • Do not call imagegen to cut an already generated atlas into individual files; it will redraw and drift.
  • Do not crop by the black preview background. Crop from the alpha channel.
  • Do not trust auto slicing when sprites touch or sit very close. Use --boxes for production assets.
  • When a crop still contains neighboring fragments, add clear rectangles or keep_largest in the boxes JSON.
  • Do not put outputs directly into a Cocos assets/ folder unless the user wants import metadata created.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.