A Claude Code plugin that removes backgrounds from AI-generated images using two-pass difference matting.
AI image generators (Gemini, DALL-E, Midjourney, etc.) often don't support transparent backgrounds. You get a PNG with a solid white or black background baked in.
Generate the same image twice — once on white, once on black. The difference between the two reveals the exact transparency of every pixel:
- Fully opaque pixels look identical on both backgrounds
- Fully transparent pixels show pure white vs pure black
- Semi-transparent pixels show proportional differences
Math: alpha = 1 - colorDistance(whiteImg, blackImg) / maxDistance
This produces pixel-perfect alpha extraction — no AI guessing, no edge artifacts.
/install furic/extract-alpha
That's it — the plugin installs both skills automatically.
If you prefer to install manually:
git clone https://github.com/furic/extract-alpha.git
mkdir -p ~/.claude/skills/extract-alpha
cp extract-alpha/skills/extract/SKILL.md ~/.claude/skills/extract-alpha/SKILL.md- Python 3 with Pillow installed (
pip install Pillow)
This plugin provides two skills:
Processes a white/black background image pair and outputs a transparent PNG.
/extract-alpha:extract path/to/image_white.png
Accepts any of these file path forms:
{name}_white.png— automatically finds the matching{name}_black.png{name}_black.png— automatically finds the matching{name}_white.png{name}.png— looks for both{name}_white.pngand{name}_black.png
Output: {name}.png with full transparency, saved alongside the input files.
Generates a pair of AI image prompts (white + black background) ready for alpha extraction.
/extract-alpha:prompt a dragon logo for my fantasy game
This outputs two ready-to-use prompts:
- Prompt 1 — A detailed image generation prompt with a white background
- Prompt 2 — A follow-up prompt to swap to black background
- Run
/extract-alpha:prompt <description>to generate the prompt pair - Send Prompt 1 to your AI image generator (Gemini, ChatGPT, etc.)
- Save the result as
{name}_white.png - In the same conversation, send Prompt 2
- Save the result as
{name}_black.png - Run
/extract-alpha:extract {name}_white.png
Add this line at the end of your image prompt:
- On a pure solid white #FFFFFF background
Then send a follow-up in the same conversation:
Change the white background to a solid pure black #000000. Keep everything else exactly unchanged.
Save the results as {name}_white.png and {name}_black.png, then run /extract-alpha:extract.
Why the same conversation? The AI retains context about the exact image it just created, so only the background changes. Generating two separate images from scratch produces inconsistent results.
- Load both white-background and black-background images
- For each pixel, calculate the color distance between the two versions
- Derive alpha:
alpha = 1 - distance / maxDistance - Recover original RGB:
rgb = blackImg_rgb / alpha - Output RGBA image with extracted transparency
The script handles minor size differences between images (common with AI generators) by cropping to the smaller dimensions.
MIT