Skip to main content
Agent skill

Image Region Remove Key Color App

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.

Get started

Get the complete skill folder, including its scripts and reference files.

When to use this skill

Use Image Region Remove Key Color App when an AI agent needs a reusable SKILL.md workflow for this job: 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.

When not to use it

Skip Image Region Remove Key Color App when the task is outside the productivity category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.

How to install

Where will you use it?

Install scope
Claude Code folder setup
mkdir -p ~/.claude/skills/image-region-remove-key-color-app
# Save SKILL.md to ~/.claude/skills/image-region-remove-key-color-app/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/image-region-remove-key-color-app/SKILL.md. For a shared project, commit the folder at .claude/skills/image-region-remove-key-color-app/ instead.
  2. Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
  3. For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.

Full install guide for Claude, Cursor, and Codex →

Try a starter prompt

After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.

Starter prompt
Use the Image Region Remove Key Color App skill for this task: Use Image Region Remove Key Color App when this documented workflow matches the task. Confirm any required inputs or files before making changes.

What supports this recommendation?

70/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.

Documentation
77/100
Practical detail
68/100
Source evidence
61/100
Source signals
72/100
Model compatibility evidence
  • claudeuntested

    No model-specific signal or recorded compatibility test was found.

  • chatgptuntested

    No model-specific signal or recorded compatibility test was found.

  • geminiuntested

    No model-specific signal or recorded compatibility test was found.

  • copilotuntested

    No model-specific signal or recorded compatibility test was found.

  • llamauntested

    No model-specific signal or recorded compatibility test was found.

  • perplexityuntested

    No model-specific signal or recorded compatibility test was found.

  • mistraluntested

    No model-specific signal or recorded compatibility test was found.

  • grokuntested

    No model-specific signal or recorded compatibility test was found.

Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.

What this skill does

# 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](../image-remove-white-background/SKILL.md) when edge flood fill leaves enclosed white islands (e.g. gaps inside a silhouette).

## Rules

When this skill applies, read and follow [skill-dependency-manager](../skill-dependency-manager.md) — 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:

```bash .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:

```bash .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`:

```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

```bash # 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:

| `--preset` | Key color | Default tolerance | |------------|-----------|-------------------| | `white` *(default)* | `#FFFFFF` | 25 | | `green` | `#00FF00` | 40 | | `magenta` | `#FF00FF` | 40 |

## 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

| Option | Default | Notes | |--------|---------|-------| | Download name | same as source (`.png`) | Prepared on Apply via `DownloadButton` | | `--preset` | `white` | Match the batch key skill | | `--tolerance` | preset-specific | Raise for gray fringes | | `--feather` | `2` | Softens hole edges inside the paint mask | | `--port` | `7860` | Change if busy | | Share | off | `share=False`; no share UI |

## Troubleshooting

| Issue | Fix | |-------|-----| | Manifest / venv missing | Follow **Setup**; update manifest | | `No paint strokes found` | Brush visibly over the white islands; ensure strokes are on the editor layers | | Subject holes outside paint | Only paint the background islands — strokes gate keying | | Leftover fringe in region | Raise tolerance by 5–10 | | Port in use | Pass `--port 7861` (etc.) | | Gradio import error | Reinstall in the skill venv: `pip install -U Pillow gradio` |

## CLI

Copy-paste commands: [cli/image-region-remove-key-color-app.md](../../../cli/image-region-remove-key-color-app.md)

## Related

- Full-image / batch keying: [image-remove-white-background](../image-remove-white-background/SKILL.md) - AI matting: [image-remove-background](../image-remove-background/SKILL.md)

Intended uses

  • Use Image Region Remove Key Color App when this documented workflow matches the task.

Implementation notes

  • Review the source instructions and adapt inputs before running the workflow.

Try it, then tell us how it went

A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.