Skip to content
Back to skills

Image Transparency

ASecurity

Use when the user asks to remove a white/grey background from an image, logo, or signature to make it transparent, using NumPy and Pillow.

  • 17 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentspythongo

Security analysis

A100/100

Scanned September 2, 2026

npx -y skills add CarlosCaPe/octorato --skill image-transparency --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Image Transparency?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Image Transparency
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/carloscape-image-transparency/badge)](https://www.skillsdirectory.com/skills/carloscape-image-transparency)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "image-transparency"
description: "Use when the user asks to remove a white/grey background from an image, logo, or signature to make it transparent, using NumPy and Pillow."
---

# Image Transparency Skill (Background Removal)

Removes solid backgrounds (like white paper from a scanned signature or white backgrounds from logos) and converts them to a transparent PNG.

## When to use
- The user provides an image with a solid or grey/white background and needs it transparent.
- Adapting signatures or logos for documents (PDFs, watermarks) where the background interferes with the layout.

## Workflow
1. Use Python with `Pillow` and `NumPy` to evaluate image threshold.
2. Mask pixels above the light threshold (background) and set their Alpha channel to 0.
3. Normalize ink/foreground pixels to a solid color if needed (e.g. ink blue `#1a1a2e` or pure black `#000000`).
4. Save as a new `_transparent.png` file or overwrite if requested.

## Code Example (Python)
```python
from PIL import Image
import numpy as np

def make_transparent(input_path, output_path, threshold=180, fg_color=None):
    img = Image.open(input_path).convert('RGBA')
    arr = np.array(img)
    
    # Convert to grayscale to find dark vs light
    gray = Image.open(input_path).convert('L')
    gray_arr = np.array(gray)
    
    # Background mask (light areas)
    bg_mask = gray_arr >= threshold
    arr[bg_mask, 3] = 0 # Set alpha to 0 completely transparent
    
    # Foreground mask (dark areas)
    if fg_color:
        ink_mask = gray_arr < threshold
        arr[ink_mask, 0] = fg_color[0]
        arr[ink_mask, 1] = fg_color[1]
        arr[ink_mask, 2] = fg_color[2]
        
    out_img = Image.fromarray(arr)
    out_img.save(output_path)
    print(f"Saved transparent image to {output_path}")

# make_transparent('firma.png', 'firma_trans.png', fg_color=(26, 26, 46))
```

*Note on "nano banana": Historically triggered by dictation typos for "una nueva [skill]". This skill embodies that rule for simple scripted transparency!*

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…