remove-background

remove-background is a command for coding agents from Comfy-Org/comfy-skills. It costs 10 tokens per session (499 once invoked), scanned A, original, MIT.

A command for removing an image's background through Comfy Cloud, producing a transparent result or placing the subject over a replacement background.

In plain words
What is it for?
Use it to upload an image, separate its subject with a background-removal workflow, and save the result as a PNG that can preserve transparency.
Why use it?
It removes the need to manually select the subject and create a transparency mask.

Command

Part of the claude-code plugin — 12 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/comfy-org/comfy-skills/remove-background
Clone the repo
git clone --depth 1 https://github.com/Comfy-Org/comfy-skills

Or install claude-code, the plugin that ships this one along with the rest of its 12 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for remove-background

README.md
[![agentmods](https://agentmods.dev/badge/commands/comfy-org/comfy-skills/remove-background.svg)](https://agentmods.dev/commands/comfy-org/comfy-skills/remove-background)
Your own site
<a href="https://agentmods.dev/commands/comfy-org/comfy-skills/remove-background"><img src="https://agentmods.dev/badge/commands/comfy-org/comfy-skills/remove-background.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 499 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.00499
Opus 5 $0.00005 $0.00249
Sonnet 5 $0.00002 $0.00100
Haiku 4.5 $0.00001 $0.00050

Measured 4d ago against content hash 2bc27f32ce20, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

remove-background scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

8. Call `get_output` to retrieve the result. Pass a short `description` parameter (e.g. "transparent-portrait") so the suggested filename is descriptive, then run the returned curl command in the user's shell to download
claude-code/commands/remove-background.md · 32 lines

What it actually says

Remove the background from an image using Comfy Cloud: $ARGUMENTS

Follow these steps exactly:

  1. Use search_templates with queries like "remove background", "background removal", or "transparent background" to find a pre-built background removal workflow template. If a good template exists, use it as the base workflow instead of building from scratch.

  2. If no suitable template was found, use search_nodes to find background removal nodes. Search for "RMBG", "background removal", "SAM", or "segment". Common nodes: RMBG (fast automatic removal), SAM (segment anything for precise masks), BiRefNet (high-quality matting).

  3. The user must provide an input image. Use upload_file to upload it to Comfy Cloud. Use the returned filename in a LoadImage node.

  4. Build a ComfyUI API-format workflow JSON for background removal. A typical workflow uses: LoadImage → background removal node (e.g. RMBG) → SaveImage (with PNG format to preserve transparency). If the user wants to replace the background rather than make it transparent, add a second image and composite them.

  5. Validate the workflow has inputs and outputs before submitting. Confirm the JSON contains:

    • At least one input node (LoadImage for the source image).
    • At least one output/save node wired to the final image (SaveImage with PNG format to preserve transparency).

    Without an output node the job runs successfully but produces nothing retrievable, wasting compute. Do not skip this check.

  6. Call submit_workflow with the workflow JSON.

  7. Poll get_job_status every 3 seconds until the job is completed. Show the user a brief status update while waiting. If the user asks to cancel, use cancel_job with the prompt_id.

  8. Call get_output to retrieve the result. Pass a short description parameter (e.g. "transparent-portrait") so the suggested filename is descriptive, then run the returned curl command in the user's shell to download the file.

  9. Display the result to the user. Note that the output is a PNG with transparency if background was removed (not replaced).

If any step fails, show the error clearly. If background removal nodes aren't available, suggest using an inpainting approach as a fallback.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 32 lines · 10 tokens per session scan A 2bc27f32ce20

Subscribe to this mod's changes

remove-background is a command published in the GitHub repository Comfy-Org/comfy-skills (182 stars, last pushed 6d ago), licensed MIT. It adds 10 tokens to every session and 499 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.