I

background-removal

by inferen-sh

Remove image backgrounds with the background-removal skill using BiRefNet via the inference.sh CLI. Ideal for product photos, portraits, e-commerce imagery, transparent PNGs, and fast photo cutouts.

Stars232
Favorites0
Comments0
AddedMar 27, 2026
CategoryImage Editing
Install Command
npx skills add https://github.com/inferen-sh/skills --skill background-removal
Overview

Overview

What the background-removal skill does

The background-removal skill automates high-quality background removal for images using the BiRefNet model through the inference.sh (infsh) CLI.

It is designed for:

  • Clean product photos for e-commerce and marketplaces
  • Portrait and profile photo cutouts
  • Marketing and social creatives needing transparent PNGs
  • Fast photo editing where you want to remove or replace the background with minimal manual work

The skill uses inference.sh tools only (Bash infsh * commands), so it fits naturally into shell scripts, CI pipelines, and other automated image workflows.

Key capabilities

  • Accurate background removal with BiRefNet for clear subject cutouts
  • Transparent background output suitable for PNG exports and compositing
  • Prompt-based background changes using the falai/reve app (e.g., swap in a new scene)
  • Generate-then-edit workflow where you first create an image with an AI model, then refine it by removing or changing the background

Who is this skill for?

Use the background-removal skill if you:

  • Manage e-commerce catalogs and need consistent, clean product imagery
  • Work in marketing or design and want to automate repetitive cutout tasks
  • Run batch image pipelines (scripts or CI jobs) and want CLI-first background removal
  • Already use or are willing to use the inference.sh CLI to run AI image models

It is less suitable if you need:

  • A graphical desktop editor only (no terminal use)
  • Fully offline processing without remote AI inference
  • Very tight, custom pixel-level masking controlled by hand instead of model output

How to Use

Prerequisites

Before using the background-removal skill, ensure you have:

  • A working terminal environment (macOS, Linux, or WSL/PowerShell on Windows)
  • The inference.sh CLI (infsh) installed
  • An inference.sh account to run apps like infsh/birefnet and falai/reve

Install instructions for the CLI are maintained in the repository:

  • https://raw.githubusercontent.com/inference-sh/skills/refs/heads/main/cli-install.md

Install the background-removal skill

Install the skill into your agent or local skills setup with:

npx skills add https://github.com/inferen-sh/skills --skill background-removal

This pulls the background-removal configuration from the inferen-sh/skills repository so your agent can call the relevant infsh apps and workflows.

Step 1 – Log in with inference.sh CLI

After installing infsh, authenticate so you can run models:

infsh login

Follow the on-screen instructions to complete login.

Step 2 – Run BiRefNet for background removal

For straightforward background removal (e.g., turning a product photo into a transparent PNG), call the BiRefNet app directly via the CLI:

infsh app run infsh/birefnet --input '{
  "image_url": "https://your-photo.jpg"
}'

Replace https://your-photo.jpg with a publicly accessible image URL. The app returns JSON output containing links to the processed image with the background removed.

Step 3 – Edit backgrounds with Reve (optional)

If you want to do more than just remove the background—such as changing it to a specific scene—the skill shows how to use Reve for image editing.

Remove the background and make it transparent

infsh app run falai/reve --input '{
  "prompt": "remove the background, make it transparent",
  "image_url": "https://portrait.jpg"
}'

Change the background to a new scene

infsh app run falai/reve --input '{
  "prompt": "change the background to a beach",
  "image_url": "https://product-photo.jpg"
}'

Adjust the prompt text to describe the background you want (studio white, gradient, office, nature, and so on).

Step 4 – Generate then edit (AI image workflow)

The background-removal skill also demonstrates a generate-and-edit pattern:

  1. Generate an image with an AI model
  2. Edit it to remove or adjust the background

Example (structure based on the repository snippet):

# 1. Generate an image
infsh app run falai/flux-dev-lora --input '{
  "prompt": "a cute robot mascot"
}' > robot.json

# 2. Extract the image_url from robot.json (using jq or similar), then edit with Reve
# (Pseudo-example; adapt to your own tooling)
IMAGE_URL=$(jq -r '.image_url' robot.json)

infsh app run falai/reve --input "{
  \"prompt\": \"remove background, make it transparent\",
  \"image_url\": \"$IMAGE_URL\"
}"

This pattern works well if you generate many images first, then batch-process them for marketing or product use.

Integrating into scripts and automation

Because the background-removal skill is CLI-driven, it integrates easily with Bash scripts or CI workflows:

  • Loop over a CSV or list of product image URLs
  • Call infsh app run infsh/birefnet for each one
  • Save the returned URLs or downloaded files into your asset pipeline

Example Bash sketch:

while read -r URL; do
  echo "Processing $URL"
  infsh app run infsh/birefnet --input "{\"image_url\": \"$URL\"}" >> results.json
done < product-images.txt

Adapt this to your own storage (S3, CDN, local folders) and post-processing needs.


FAQ

When should I use the background-removal skill instead of a desktop editor?

Use the background-removal skill when you need repeatable, scriptable background removal—especially for many images. It is ideal for teams that prefer CLI tools, automation, or integrating AI image editing into existing pipelines. For one-off edits where you prefer visual control, a desktop editor might be more comfortable.

What models and tools does background-removal rely on?

The skill is built around:

  • BiRefNet (infsh/birefnet) for high-accuracy background removal
  • Reve (falai/reve) for prompt-based image editing, including background changes
  • flux-dev-lora (falai/flux-dev-lora) in the example workflow for image generation
  • The inference.sh CLI (infsh) as the execution interface

Do I need the inference.sh CLI for this skill to work?

Yes. The background-removal skill assumes you have the inference.sh CLI installed and configured. The commands shown in the skill (such as infsh login and infsh app run ...) will not work without it.

Can I use local image files instead of URLs?

The repository examples use image_url with HTTP links. Support for local files depends on the current capabilities of the infsh CLI and specific app definitions. Check the latest infsh documentation and app reference for infsh/birefnet and falai/reve to see whether local file paths or file uploads are supported in your environment.

Is the background-removal skill suitable for fully offline use?

No. The background-removal skill calls remote inference apps via the inference.sh platform, so it requires network access. If you need offline-only processing, you would need a different, locally hosted solution.

What are typical use cases for marketing and e-commerce?

Common uses include:

  • Turning raw product shots into clean, transparent PNGs for storefronts and marketplaces
  • Standardizing backgrounds across a catalog (e.g., all white or all light gray)
  • Preparing campaign visuals by removing or swapping backgrounds on hero images
  • Quickly cleaning up influencer or portrait photos for landing pages and social media

How do I get started quickly with minimal setup?

  1. Install the inference.sh CLI following the cli-install.md instructions.
  2. Run infsh login.
  3. Test a single image with:
    infsh app run infsh/birefnet --input '{
      "image_url": "https://your-photo.jpg"
    }'
    
  4. Once you are happy with the result, integrate the command into your scripts or agent configuration via the background-removal skill.

Where can I see the skill’s configuration?

In the inferen-sh/skills repository, open the tools/image/background-removal/SKILL.md file. It documents the skill name, description, allowed tools, and the example commands summarized in this guide.

Ratings & Reviews

No ratings yet
Share your review
Sign in to leave a rating and comment for this skill.
G
0/10000
Latest reviews
Saving...