{
  "markdown": "# Extract Alpha &middot; [![Claude Code Plugin](https://img.shields.io/badge/Claude_Code-Plugin-blue)](https://docs.anthropic.com/en/docs/claude-code) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Python](https://img.shields.io/badge/Python-3.x-yellow?logo=python&logoColor=white)](https://www.python.org/) [![Pillow](https://img.shields.io/badge/Pillow-required-orange)](https://python-pillow.org/)\n\nA [Claude Code](https://docs.anthropic.com/en/docs/claude-code) plugin that removes backgrounds from AI-generated images using **two-pass difference matting**.\n\n## The Problem\n\nAI 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.\n\n## The Solution\n\nGenerate the **same image twice** — once on white, once on black. The difference between the two reveals the exact transparency of every pixel:\n\n- **Fully opaque** pixels look identical on both backgrounds\n- **Fully transparent** pixels show pure white vs pure black\n- **Semi-transparent** pixels show proportional differences\n\nMath: `alpha = 1 - colorDistance(whiteImg, blackImg) / maxDistance`\n\nThis produces pixel-perfect alpha extraction — no AI guessing, no edge artifacts.\n\n## Quick Install\n\n```\n/install furic/extract-alpha\n```\n\nThat's it — the plugin installs both skills automatically.\n\n### Manual Install\n\nIf you prefer to install manually:\n\n```bash\ngit clone https://github.com/furic/extract-alpha.git\nmkdir -p ~/.claude/skills/extract-alpha\ncp extract-alpha/skills/extract/SKILL.md ~/.claude/skills/extract-alpha/SKILL.md\n```\n\n### Requirements\n\n- Python 3 with [Pillow](https://python-pillow.org/) installed (`pip install Pillow`)\n\n## Skills\n\nThis plugin provides two skills:\n\n### `/extract-alpha:extract` — Extract transparency\n\nProcesses a white/black background image pair and outputs a transparent PNG.\n\n```\n/extract-alpha:extract path/to/image_white.png\n```\n\nAccepts any of these file path forms:\n- `{name}_white.png` — automatically finds the matching `{name}_black.png`\n- `{name}_black.png` — automatically finds the matching `{name}_white.png`\n- `{name}.png` — looks for both `{name}_white.png` and `{name}_black.png`\n\nOutput: `{name}.png` with full transparency, saved alongside the input files.\n\n### `/extract-alpha:prompt` — Generate image prompts\n\nGenerates a pair of AI image prompts (white + black background) ready for alpha extraction.\n\n```\n/extract-alpha:prompt a dragon logo for my fantasy game\n```\n\nThis outputs two ready-to-use prompts:\n1. **Prompt 1** — A detailed image generation prompt with a white background\n2. **Prompt 2** — A follow-up prompt to swap to black background\n\n## Workflow\n\n### Option A: Use the prompt skill (recommended)\n\n1. Run `/extract-alpha:prompt <description>` to generate the prompt pair\n2. Send Prompt 1 to your AI image generator (Gemini, ChatGPT, etc.)\n3. Save the result as `{name}_white.png`\n4. In the **same conversation**, send Prompt 2\n5. Save the result as `{name}_black.png`\n6. Run `/extract-alpha:extract {name}_white.png`\n\n### Option B: Write prompts manually\n\nAdd this line at the end of your image prompt:\n\n```\n- On a pure solid white #FFFFFF background\n```\n\nThen send a follow-up in the same conversation:\n\n```\nChange the white background to a solid pure black #000000. Keep everything else exactly unchanged.\n```\n\nSave the results as `{name}_white.png` and `{name}_black.png`, then run `/extract-alpha:extract`.\n\n> **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.\n\n## How It Works\n\n1. Load both white-background and black-background images\n2. For each pixel, calculate the color distance between the two versions\n3. Derive alpha: `alpha = 1 - distance / maxDistance`\n4. Recover original RGB: `rgb = blackImg_rgb / alpha`\n5. Output RGBA image with extracted transparency\n\nThe script handles minor size differences between images (common with AI generators) by cropping to the smaller dimensions.\n\n## License\n\nMIT\n",
  "bytes": 4134,
  "sha": "ace5becd68d17e7334566d999442a6300813d36bd99ad87219410d383f70825a",
  "repo_slug": "furic/extract-alpha",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_furic_extract_alpha_extract_alpha_707cfedd/readme"
}