agentleFS
godot-fungodot-fun/gai/.agents/skills/image-region-remove-key-color-app/SKILL.md

image-region-remove-key-color-app

Skill210 starsChanged 2 days agoMITView on GitHub

Interactive Gradio UI to paint a region and remove solid key-color background (white / green / magenta) only inside that selection. Use when enclosed white islands remain after border/both keying, for localized white-background cutout, paint-to-erase chroma patches, or selective color-key cleanup before Godot sprite import.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use after image-remove-white-background when edge flood fill leaves enclosed white islands (e.g.

    line 14
  2. Very specific:

    When this skill applies, read and follow dependency-manager — run scripts as documented, install missing tools into .dependency/.

    line 18
  3. Very specific:

    Run app.py through the image-region-remove-key-color-app manifest entry (.dependency/image-region-remove-key-color-app/.venv/).

    line 20
  4. Very specific:

    Do not hand-write a one-off Gradio app — use the bundled script at .ai/image-region-remove-key-color-app/app.py.

    line 21
  5. Very specific:

    If python -m venv fails (missing venv / ensurepip), create the env with virtualenv from another populated skill venv, then install packages …

    line 34
  6. Very specific:

    Use bin/python on Unix.

    line 51
  7. Very specific:

    Use the UI color picker (default #FFFFFF).

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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

Image Region Remove Key Color App

Paint a region mask in a local Gradio UI, then remove key-color pixels only inside that region (global keying scoped to the brush). Preserves white/light subject pixels outside the paint strokes.

Use after image-remove-white-background when edge flood fill leaves enclosed white islands (e.g. gaps inside a silhouette).

Rules

When this skill applies, read and follow dependency-manager — run scripts as documented, install missing tools into .dependency/.

  • Run app.py through the image-region-remove-key-color-app manifest entry (.dependency/image-region-remove-key-color-app/.venv/). Never use host python, py, python3, or any interpreter outside .dependency/.
  • Do not hand-write a one-off Gradio app — use the bundled script at .ai/image-region-remove-key-color-app/app.py.
  • populated: false is not a reason to skip. Install first, set populated: true, retry the same command.
  • This skill is interactive: launch the UI, give the user the local URL, wait for them to paint / Apply / Download.

Setup (first run)

From project root:

.dependency/python/python -m venv .dependency/image-region-remove-key-color-app/.venv
.dependency/image-region-remove-key-color-app/.venv/Scripts/python.exe -m pip install Pillow gradio

If python -m venv fails (missing venv / ensurepip), create the env with virtualenv from another populated skill venv, then install packages into the new env:

.dependency/rembg/.venv/Scripts/python.exe -m pip install virtualenv
.dependency/rembg/.venv/Scripts/python.exe -m virtualenv .dependency/image-region-remove-key-color-app/.venv
.dependency/image-region-remove-key-color-app/.venv/Scripts/python.exe -m pip install Pillow gradio

Register in .dependency/manifest.json:

"image-region-remove-key-color-app": {
  "populated": true,
  "bin": ".dependency/image-region-remove-key-color-app/.venv/Scripts/python.exe"
}

Use bin/python on Unix.

Quick Start

# Preload an image (opens http://127.0.0.1:7860)
.dependency/image-region-remove-key-color-app/.venv/Scripts/python.exe .ai/image-region-remove-key-color-app/app.py path/to/sprite.png

# Custom port, no auto-open browser (agent / headless)
.dependency/image-region-remove-key-color-app/.venv/Scripts/python.exe .ai/image-region-remove-key-color-app/app.py path/to/sprite.png --port 7861 --no-browser

Download uses the same filename as the source (forced .png). No share / no save-to-disk folder.

UI workflow

  1. Upload the image via the file control (or preload via CLI) — do not drop into the editor canvas.
  2. Transparent areas appear as gray in the editor (download still has real alpha).
  3. Paint over local white / chroma patches to remove.
  4. Choose Key color / tolerance / feather if needed.
  5. Click Apply → preview (gray = transparent).
  6. Click Download → browser download with the original name.
  7. Click Stop server when done (or Ctrl+C in the terminal).

Key color

Use the UI color picker (default #FFFFFF). CLI --preset only sets the initial color and tolerance:

--presetKey colorDefault tolerance
white (default)#FFFFFF25
green#00FF0040
magenta#FF00FF40

Agent workflow

  1. When — user needs selective / painted removal of flat key-color patches; full-image global would damage white subjects; border/both left enclosed islands.
  2. Ensure deps — manifest entry + venv with Pillow + Gradio.
  3. Launch — run app.py with the user image path; prefer --no-browser if the agent cannot open a GUI browser, and print http://127.0.0.1:<port>.
  4. Hand off — tell the user to paint, Apply, then Download (same filename as source).
  5. Verify — after the user confirms download, they are done; do not overwrite sources.
  6. Stop — click Stop server in the UI, or terminate the Gradio process when the user is done.

Defaults

OptionDefaultNotes
Download namesame as source (.png)Prepared on Apply via DownloadButton
--presetwhiteMatch the batch key skill
--tolerancepreset-specificRaise for gray fringes
--feather2Softens hole edges inside the paint mask
--port7860Change if busy
Shareoffshare=False; no share UI

Troubleshooting

IssueFix
Manifest / venv missingFollow Setup; update manifest
No paint strokes foundBrush visibly over the white islands; ensure strokes are on the editor layers
Subject holes outside paintOnly paint the background islands — strokes gate keying
Leftover fringe in regionRaise tolerance by 5–10
Port in usePass --port 7861 (etc.)
Gradio import errorReinstall in the skill venv: pip install -U Pillow gradio

CLI

Copy-paste commands: cli/image-region-remove-key-color-app.md

Related

  • Full-image / batch keying: image-remove-white-background
  • AI matting: image-remove-background

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.