AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Rembg Bg Removal

skill-openghz-rembg-bg-removal-rembg-bg-removal · by OpenGHz

>-

No reviews yet
0 installs
32 views
0.0% view→install

Install

$ agentstack add skill-openghz-rembg-bg-removal-rembg-bg-removal

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-openghz-rembg-bg-removal-rembg-bg-removal)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Rembg Bg Removal? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

rembg background removal

Removes image backgrounds using rembg. The hard part isn't the removal itself — it's getting a working, isolated environment with a GPU backend that matches the machine's CUDA version. This skill bundles that setup so it's a one-time script, then a thin run wrapper.

Workflow

  1. Ensure the environment exists. Check for it before running anything:

``bash # conda (default when conda is present): conda env list | grep -q '\brembg\b' && echo EXISTS # venv fallback: test -x ~/.venvs/rembg/bin/rembg && echo EXISTS ``

If it doesn't exist, run the setup script (see below). If it exists, skip straight to running.

  1. Run background removal via the wrapper (auto-detects file vs folder):

``bash bash /scripts/run_rembg.sh [-m MODEL] [flags] ``

  1. Report where the outputs went and which model was used. If the user

cares about quality, point them at the tuning options.

Setup (first time only)

Run the bundled installer. It creates a dedicated environment and installs only there — it never modifies the user's active or base environment.

bash /scripts/setup_env.sh

What it does, and why:

  • Isolation. Creates a dedicated conda env named rembg (or a venv at

~/.venvs/rembg if conda isn't available). It computes an explicit interpreter path and installs with -m pip, so nothing lands in whatever env happens to be active.

  • Backend matched to CUDA. Reads the driver's CUDA version from

nvidia-smi. For CUDA 12.x it installs onnxruntime-gpu==1.22.0 plus the matching nvidia-cudnn-cu12 / cublas / cuda-runtime wheels. This matters: the latest onnxruntime-gpu (1.23+) is built for CUDA 13 and fails to import on a CUDA-12 box with libcudart.so.13: cannot open shared object file. For CUDA ≥13 it uses the latest GPU build; with no GPU it uses the CPU build.

  • Loader path. onnxruntime-gpu needs the pip NVIDIA libs on

LD_LIBRARY_PATH. The installer adds a conda activate.d hook, and the run wrapper sets it too (so venv works), so the user never has to export anything.

  • Model prefetch. Downloads birefnet-general (~928MB) and u2net with

wget -c resume + md5 verification, because the GitHub-release links routinely drop mid-download.

Useful overrides (env vars): ENV_TYPE=venv, ENV_PATH=~/.venvs/rembg, FORCE_CPU=1, PROXY=http://127.0.0.1:7890 (route downloads through a proxy; empty by default), RECREATE=1 (rebuild from scratch), MODELS="birefnet-general isnet-anime".

Running

The wrapper handles single files and folders identically — pass a file to get a file, a directory to get a directory of cutouts. The output path is optional: omit it and the wrapper writes next to the input with a _rembg suffix (photo.jpgphoto_rembg.png, icons/icons_rembg/), so you don't have to invent one.

# single image, auto output -> photo_rembg.png
bash /scripts/run_rembg.sh photo.jpg

# explicit output
bash /scripts/run_rembg.sh photo.jpg photo_cutout.png

# whole folder, auto output -> icons_rembg/
bash /scripts/run_rembg.sh ./icons -m birefnet-general -ppm

# pick a model / pass rembg flags (flags may follow the input directly)
MODEL=isnet-anime bash /scripts/run_rembg.sh char.png -ppm

The wrapper unsets any socks:// proxy first (it crashes rembg's gradio import). It uses no proxy by default; set PROXY to route on-demand model downloads through an http proxy.

Choosing a model & tuning quality

Default is birefnet-general (best general edges). If the user is unhappy with edges, mentions hair/soft edges, anime, or portraits, or wants a solid-color background, read references/models_and_flags.md for the full model table and the flag-tuning order (start with -ppm, then a stronger model, then -a alpha matting with -ae erode tuning).

Troubleshooting

  • No onnxruntime backend found — the GPU wheel failed to import (usually a

CUDA-major mismatch). Re-run setup_env.sh; it picks the matching backend.

  • libcudart.so.13: cannot open shared object file — onnxruntime-gpu is built

for CUDA 13 but the box has CUDA 12. This is exactly what the version pin in setup_env.sh fixes.

  • Unknown scheme for proxy URL 'socks://...' — a socks:// all_proxy breaks

gradio/httpx. The run wrapper unsets it; if running rembg by hand, do unset all_proxy ALL_PROXY first.

  • The CLI dependencies are not installed — rembg was installed without the

[cli] extra. setup_env.sh installs rembg[cpu,cli]; re-run it.

  • Model download stalls / SSL EOF — set a working PROXY, or pre-download with

wget -c into ~/.u2net/.onnx (the installer does this).

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.