Remove backgrounds from images using local AI (rembg). An agent skill from peterkrueck/Claude-Code-Development-Kit.

MITAuto-check passedMedia & Creative

Install Bg Remove

skills CLI
$ npx skills add peterkrueck/Claude-Code-Development-Kit --skill bg-remove -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install peterkrueck/Claude-Code-Development-Kit bg-remove --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/peterkrueck/Claude-Code-Development-Kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/bg-remove .claude/skills/bg-remove && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bg-remove
GitHub stars
1.4k
Token cost
~1.3k tokens
SKILL.md length
415 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
MIT

At a glance

Remove backgrounds from images using local AI (rembg). An agent skill from peterkrueck/Claude-Code-Development-Kit.

  • Works in 5 steps: Verify Input → Remove Background → Verify Result → …
  • Removing backgrounds from character art
  • SKILL.md covers Input, Setup, Process and Important Rules
  • Calls python3 and pip

What it does

Bg Remove is an agent skill from peterkrueck/Claude-Code-Development-Kit. Remove backgrounds from images using local AI (rembg). Use when removing backgrounds from character art, mascot images, photos, or any image that needs a transparent background.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Media & Creative, covering Image editing. The repository describes itself as: Claude Code Workflow for beginners & intermediate users. Tutorial and Installer included. The licence is MIT.

When your agent uses it

  • Removing backgrounds from character art
  • Any image that needs a transparent background

Example prompts

  • “/bg-remove”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Verify Input
  2. Remove Background
  3. Verify Result
  4. Optional Trim
  5. Report

What it can do on your machine

Read from SKILL.md and the folder at commit ba85375. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python3
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bg Remove loads about 1.3k tokens when it runs. Until then it costs about 47 tokens; SKILL.md has 415 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~47
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from peterkrueck/Claude-Code-Development-Kit at commit ba85375, republished under its MIT licence (© peterkrueck). 415 words, ~1,312 tokens.

Download SKILL.mdSave it as .claude/skills/bg-remove/SKILL.md (or your agent's skills folder).
name
bg-remove
description
Remove backgrounds from images using local AI (rembg). Use when removing backgrounds from character art, mascot images, photos, or any image that needs a transparent background.
user_invocable
true

Background Remove — Local AI Background Removal

Remove backgrounds from images using rembg (local, offline, no data sent externally). Outputs RGBA PNG with proper transparency.

Input

Arguments after /bg-remove:

  • Source image path (required) — path to the image
  • --trim (optional) — auto-trim transparent padding after removal
  • --output <path> (optional) — custom output path. Default: same directory, <name>-transparent.png

Examples:

  • /bg-remove assets/character/mascot.png
  • /bg-remove image.png --trim
  • /bg-remove image.png --output ~/Desktop/result.png

Setup

rembg is installed in a dedicated venv. Always activate it before use:

bash
source ~/.claude/tools/rembg-env/bin/activate

If the venv doesn't exist, install it:

bash
python3 -m venv ~/.claude/tools/rembg-env && source ~/.claude/tools/rembg-env/bin/activate && pip install "rembg[cpu,cli]"

Model files are cached in ~/.u2net/ (downloaded on first use per model, ~170MB for birefnet-general).

Process

Step 1: Verify Input
  1. Check the source image exists
  2. Get dimensions: sips -g pixelWidth -g pixelHeight <path>
  3. View the image with the Read tool to understand what we're working with
Step 2: Remove Background

Use the birefnet-general model — validated in testing on illustrated/character art and general photos, producing clean edges across both.

bash
source ~/.claude/tools/rembg-env/bin/activate && rembg i -m birefnet-general <input> <output>

Model choice: Default to birefnet-general. In side-by-side testing it gave clean edges on both illustrated subjects and photographic ones. Avoid anime-trained models (e.g. isnet-anime): on non-anime and even some illustrated inputs they tend to add artifacts and leave dark patches around edges. If birefnet-general underperforms on a specific image, compare against another general model rather than an anime-specific one.

Step 3: Verify Result

The Read tool renders transparency as black, so you MUST verify by compositing on a colored background:

bash
source ~/.claude/tools/rembg-env/bin/activate && python3 -c "
from PIL import Image
import numpy as np

# Load result
img = Image.open('<output>').convert('RGBA')
alpha = np.array(img)[:,:,3]
total = alpha.size
transparent = np.sum(alpha == 0)
opaque = np.sum(alpha == 255)
print(f'Dimensions: {img.size}')
print(f'Transparent: {transparent/total*100:.1f}%')
print(f'Opaque: {opaque/total*100:.1f}%')
print(f'Corners alpha: TL={alpha[0,0]} TR={alpha[0,-1]} BL={alpha[-1,0]} BR={alpha[-1,-1]}')

# Composite on magenta for visual verification
bg = Image.new('RGBA', img.size, (255, 0, 255, 255))
bg.paste(img, (0, 0), img)
bg.save('<output_dir>/verify-magenta.png')
print('Verification image saved')
"

Then view the magenta verification image with the Read tool. The magenta should only show where background was removed.

Show full SKILL.md (162 more words)Show less
Step 4: Optional Trim

If --trim was requested, trim transparent padding:

bash
source ~/.claude/tools/rembg-env/bin/activate && python3 -c "
from PIL import Image
import numpy as np

img = Image.open('<output>').convert('RGBA')
alpha = np.array(img)[:,:,3]

# Find bounding box of non-transparent pixels
rows = np.any(alpha > 0, axis=1)
cols = np.any(alpha > 0, axis=0)
rmin, rmax = np.where(rows)[0][[0, -1]]
cmin, cmax = np.where(cols)[0][[0, -1]]

# Add small padding (2% of dimensions)
pad_h = max(int(img.height * 0.02), 4)
pad_w = max(int(img.width * 0.02), 4)
rmin = max(0, rmin - pad_h)
rmax = min(img.height - 1, rmax + pad_h)
cmin = max(0, cmin - pad_w)
cmax = min(img.width - 1, cmax + pad_w)

cropped = img.crop((cmin, rmin, cmax + 1, rmax + 1))
cropped.save('<output>')
print(f'Trimmed: {img.size} -> {cropped.size}')
"
Step 5: Report
Done: background removed
  Source: <input_path>
  Output: <output_path>
  Dimensions: <width>x<height>
  Transparent pixels: <percent>%
  Model: birefnet-general (local, offline)

Verify before shipping: open the output in Preview.app (or any viewer that shows the checkerboard pattern) to confirm real transparency. The Read tool renders transparency as solid black, so it cannot distinguish a transparent background from a black one — composite-over-a-color (Step 3) or a checkerboard viewer is the only reliable check.

Important Rules

  1. Default to birefnet-general — in side-by-side testing it produced the cleanest edges on both illustrated and photographic inputs; anime-trained models added artifacts. Only switch models if it visibly underperforms on a specific image.
  2. Always activate the venv before running rembg or Python with Pillow/numpy.
  3. Always verify with magenta composite — don't trust the Read tool's rendering of transparency.
  4. Never send images to external services — rembg runs 100% locally.
  5. Preserve original files — output to a new file, never overwrite the source.
  6. Clean up verification images — delete the magenta composite after confirming quality.

© peterkrueck, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/bg-remove of peterkrueck/Claude-Code-Development-Kit.

Open the folder on GitHubat commit ba85375

Compare with similar skills

Bg Remove next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bg Remove compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bg Remove this skillpeterkrueck/Claude-Code-Development-Kit1.4k—~1.3kAutomated safety check: PassMIT
AI Image Generation and Editingzhayujie/CowAgent47k—~1.3kAutomated safety check: PassMIT
Media Useedenfunf/reelmimic1.7k2 repos~2kAutomated safety check: PassMIT
Generate Imageynulihao/AgentSkillOS61710 repos~1.7kAutomated safety check: NotesNone
GPT Image Generation CLIwuyoscar/GPT-Image2-Skill5.7k—~2.5kAutomated safety check: NotesMIT
HyperFrames Media Useheygen-com/hyperframes59k—~2.4kAutomated safety check: PassApache-2.0

Similar skills

  • Generates or edits images from text prompts through a Python script that picks an image backend based on which API keys are configured.

    47k GitHub stars~1.3k tokensUpdated today
    Media & CreativeAuto-check passed
  • Media Use

    edenfunf/reelmimic

    Agent Media OS, the single skill for every media need in a HyperFrames project.

    1.7k GitHub starsUsed in 2 repos~2k tokens
    Media & CreativeAuto-check passed
  • Generate Image

    ynulihao/AgentSkillOS

    Generate or edit images using AI models (FLUX, Gemini). An agent skill from ynulihao/AgentSkillOS.

    617 GitHub starsUsed in 10 repos~1.7k tokens
    Media & CreativeAuto-check: notes
  • GPT Image Generation CLI

    wuyoscar/GPT-Image2-Skill

    Generates and edits images with GPT Image 2 or 2.5 through a packaged CLI and a prompt gallery, after settling which model fits the request.

    5.7k GitHub stars~2.5k tokensUpdated 8 days ago
    Media & CreativeAuto-check: notes
  • HyperFrames Media Use

    heygen-com/hyperframes

    Finds, generates and edits media for HyperFrames video projects: music, sound effects, images, icons, logos, voiceovers, captions and color grades.

    59k GitHub stars~2.4k tokensUpdated today
    Media & CreativeAuto-check passed
  • Nanobanana

    ReScienceLab/opc-skills

    Generate and edit images using Google Gemini 3 Pro Image (Nano Banana Pro).

    1.8k GitHub starsUsed in 1 repo~1.3k tokens
    Media & CreativeAuto-check passed

More from peterkrueck/Claude-Code-Development-Kit

All 9 skills in this repo
  • Image Edit

    peterkrueck/Claude-Code-Development-Kit

    Edit images with precision — crop, resize, mirror, rotate, trim, and reframe.

    1.4k GitHub stars~1.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Image Gen

    peterkrueck/Claude-Code-Development-Kit

    Generate character art and image variations using AI image generation (Google Gemini) with reference images for style and character consistency.

    1.4k GitHub stars~1.4k tokensUpdated 2 mo ago
    Auto-check passed
  • Context7 Guidance

    peterkrueck/Claude-Code-Development-Kit

    Fetch CURRENT library/framework/API/CLI documentation via Context7 instead of relying on training data.

    1.4k GitHub stars~671 tokensUpdated 2 mo ago
    Auto-check passed
  • Second Opinion

    peterkrueck/Claude-Code-Development-Kit

    Get a second opinion from OpenAI's Codex CLI running locally.

    1.4k GitHub stars~2.4k tokensUpdated 2 mo ago
    Auto-check: warnings
  • Deploy

    peterkrueck/Claude-Code-Development-Kit

    Test and deploy changes safely. An agent skill from peterkrueck/Claude-Code-Development-Kit.

    1.4k GitHub stars~3.3k tokensUpdated 2 mo ago
    Auto-check passed
  • Second Opinion Gemini

    peterkrueck/Claude-Code-Development-Kit

    Get a second opinion from Google's Gemini Pro via the locally installed Gemini CLI (defaults to gemini-3.1-pro-preview; override with the CLAUDESECONDOPINIONMODEL env var).

    1.4k GitHub stars~2.3k tokensUpdated 2 mo ago
    Auto-check: warnings

Questions about Bg Remove

What does Bg Remove do?

Remove backgrounds from images using local AI (rembg). An agent skill from peterkrueck/Claude-Code-Development-Kit. Bg Remove is an agent skill from peterkrueck/Claude-Code-Development-Kit. Remove backgrounds from images using local AI (rembg).

When should I use Bg Remove?

Bg Remove fits situations like: removing backgrounds from character art; any image that needs a transparent background.

How do I install Bg Remove in Claude Code?

Run `npx skills add peterkrueck/Claude-Code-Development-Kit --skill bg-remove -a claude-code`. Or copy the skill folder (skills/bg-remove in peterkrueck/Claude-Code-Development-Kit) into .claude/skills/bg-remove in your project. Claude Code loads it when a task matches its description.

How do I install Bg Remove in Codex?

Run `npx skills add peterkrueck/Claude-Code-Development-Kit --skill bg-remove -a codex`. Or copy the skill folder (skills/bg-remove in peterkrueck/Claude-Code-Development-Kit) into .agents/skills/bg-remove in your project. Codex loads it when a task matches its description.

Can I use Bg Remove in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add peterkrueck/Claude-Code-Development-Kit --skill bg-remove -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bg-remove, .gemini/skills/bg-remove, .github/skills/bg-remove and .opencode/skills/bg-remove in your project.

What does Bg Remove need to run?

Going by SKILL.md and its folder, Bg Remove needs the command-line tools its instructions call (python3 and pip). Our summary lists: Python 3.

Does Bg Remove access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Bg Remove safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bg Remove use?

Bg Remove is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bg Remove use?

About 1.3k tokens (SKILL.md is roughly 5.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Bg Remove?

Skills that share tags, products or a category with Bg Remove: AI Image Generation and Editing (zhayujie/CowAgent, 47k stars), Media Use (edenfunf/reelmimic, 1.7k stars), Generate Image (ynulihao/AgentSkillOS, 617 stars) and GPT Image Generation CLI (wuyoscar/GPT-Image2-Skill, 5.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bg Remove?

peterkrueck (a GitHub user) maintains it in peterkrueck/Claude-Code-Development-Kit, which has 1,385 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on July 22, 2026.

Source: peterkrueck/Claude-Code-Development-Kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.