Skip to content
Skill

bg-remover

by majiayu000

AI Summary

A skill that removes backgrounds from images using FAL.ai's BiRefNet model, enabling developers to quickly extract subjects and create transparent PNGs. Useful for anyone building image processing features into Claude-based applications.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to install the "bg-remover" skill in my project.

Please run this command in my terminal:
# Install skill into the correct directory (2 files)
mkdir -p .claude/skills/bg-remover && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/skills/bg-remover/SKILL.md "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main/skills/data/bg-remover/SKILL.md" && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/skills/bg-remover/metadata.json "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main/skills/data/bg-remover/metadata.json"

Then restart Claude Code (or reload the window in Cursor) so the skill is picked up.

Description

Remove backgrounds from images using FAL.ai's BiRefNet model. Use when users ask to remove background, make transparent PNG, extract subject from image, or create cutouts. Trigger phrases include "remove background", "transparent background", "cut out", "extract subject", or any background removal request.

Prerequisites

This skill requires: • Bun - Fast JavaScript runtime • FAL_KEY - FAL.ai API key set as environment variable

Basic Usage

Remove background from an image using a heredoc script: `bash bun run - << 'EOF' import { fal } from "@fal-ai/client"; import { readFileSync, writeFileSync } from "fs"; import { basename, dirname, join } from "path"; const imagePath = "INPUT_IMAGE_PATH"; const imageBuffer = readFileSync(imagePath); const fileName = basename(imagePath); const mimeType = imagePath.endsWith(".png") ? "image/png" : "image/jpeg"; // Upload to FAL storage const file = new File([imageBuffer], fileName, { type: mimeType }); const imageUrl = await fal.storage.upload(file); console.log("Uploaded:", imageUrl); // Remove background const result = await fal.subscribe("fal-ai/birefnet/v2", { input: { image_url: imageUrl, model: "General Use (Light)", operating_resolution: "1024x1024", output_format: "png" }, logs: true, onQueueUpdate: (update) => { if (update.status === "IN_PROGRESS" && update.logs) { update.logs.map((log) => log.message).forEach(console.log); } }, }); // Download and save result const outputUrl = result.data.image.url; const response = await fetch(outputUrl); const buffer = Buffer.from(await response.arrayBuffer()); const dir = dirname(imagePath); const nameWithoutExt = basename(imagePath, basename(imagePath).match(/\.[^.]+$/)?.[0] || ""); const outputPath = join(dir, ${nameWithoutExt}-nobg.png); writeFileSync(outputPath, buffer); console.log("Saved:", outputPath); EOF ` Replace INPUT_IMAGE_PATH with the actual path to the image.

Advanced Usage

For batch processing, URL-based inputs, or integration with other tools, see references/guide.md.

Background Remover Skill

Remove backgrounds from images using FAL.ai's BiRefNet v2 model. Uses Bun for fast TypeScript execution with inline scripts.

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 1mo ago
Active
Adoption100+ stars on GitHub
100 ★ · Growing
DocsREADME + description
Well-documented

GitHub Signals

Stars100
Forks15
Issues1
Updated1mo ago
View on GitHub
MIT License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Claude Code