# Edge halo cleanup

- Human page: https://happytails.ai/en/image-tools/edge-halo-cleanup/
- Markdown: https://happytails.ai/en/image-tools/edge-halo-cleanup.md
- Structured JSON: https://happytails.ai/agents/en/image-tools/edge-halo-cleanup/index.json
- Visibility: public

## Tool capabilities

| Property | Value |
| --- | --- |
| Tool ID | `edge-halo-cleanup` |
| Category | image-tools |
| Implementation | Registered implementation. Registration alone is not a production-quality guarantee. |
| Browser execution | Use the visible action or interactive controls. |
| Browser processing | Browser; see tool notes for network behavior. |
| HTTP API | Not callable through HTTP. |
| Browser-agent interface | run_current_tool |

### Implementation notes

Images are processed in this browser and never uploaded. Use still PNG, JPEG or WebP files up to 20 MiB each.

### Inputs and settings

No free-text input is required. Use the file inputs and/or settings below.

Accepted browser files: `.png,.jpg,.jpeg,.webp`. Choose one file.

Browser file-input limit: 20971520 bytes in total. HTTP limits can differ.

| Setting | Meaning | Control type | Default | Constraints |
| --- | --- | --- | --- | --- |
| `matte` | Matte color the cutout was made on | color | "#ffffff" |  |
| `edgeWidth` | Edge band width in pixels | number | "2" | min=1 max=64 step=1 |
| `minAlpha` | Lowest alpha to clean (1 to 254) | number | "16" | min=1 max=254 step=1 |

### Browser-agent workflow

1. Open the human page in a browser that supports WebMCP.
2. Discover the interface exposed by that page; use its actual schema.
3. Select files on the page first when the tool requires files.
4. Call `run_current_tool` with valid input and settings.
5. Inspect the returned result or error and the displayed output. Retrieve files from the displayed download links.

Calls do not automatically copy or download results. Browser permissions still apply. Interface availability alone is not proof of successful execution.

### Planning specification

Images stay in this browser and are never uploaded. Use one still PNG, JPEG or WebP image up to 20 MiB, 16,384 pixels per side and 8 million pixels. Edge band 1 to 64 pixels, lowest alpha 1 to 254. Processing stops after 30 seconds. You get the cleaned PNG, a changed-pixel PNG and a JSON report. Source metadata and color profiles are not copied.

This describes intended requirements. Use the implementation notes, interface schema and observed output to determine current support.

### Complete machine-readable capability record

```json
{
  "id": "edge-halo-cleanup",
  "category": "image-tools",
  "built": true,
  "requirements": "Images stay in this browser and are never uploaded. Use one still PNG, JPEG or WebP image up to 20 MiB, 16,384 pixels per side and 8 million pixels. Edge band 1 to 64 pixels, lowest alpha 1 to 254. Processing stops after 30 seconds. You get the cleaned PNG, a changed-pixel PNG and a JSON report. Source metadata and color profiles are not copied.",
  "implementation": {
    "fields": [
      {
        "key": "matte",
        "label": "Matte color the cutout was made on",
        "value": "#ffffff",
        "type": "color"
      },
      {
        "key": "edgeWidth",
        "label": "Edge band width in pixels",
        "value": "2",
        "type": "number",
        "min": 1,
        "max": 64,
        "step": 1
      },
      {
        "key": "minAlpha",
        "label": "Lowest alpha to clean (1 to 254)",
        "value": "16",
        "type": "number",
        "min": 1,
        "max": 254,
        "step": 1
      }
    ],
    "registrationFamily": "raster-masks-and-textures",
    "files": true,
    "input": false,
    "multiple": false,
    "accept": ".png,.jpg,.jpeg,.webp",
    "maxFileBytes": 20971520,
    "deferImagePreview": true,
    "note": "Images are processed in this browser and never uploaded. Use still PNG, JPEG or WebP files up to 20 MiB each.",
    "experience": {
      "automatic": false,
      "single": true,
      "inputMaxLength": 1000000,
      "inputMode": "text",
      "label": "Transparent cutout",
      "placeholder": "Choose a PNG with a transparent background",
      "help": "One still image up to 20 MiB and 8 million pixels. Up to 1,000,000 characters. Review the settings before running.",
      "action": null
    },
    "mode": "explicit",
    "interactive": false
  },
  "execution": "Browser interface",
  "api": null,
  "browser_agent": {
    "supported": true,
    "name": "run_current_tool",
    "discovery": "WebMCP on the human page in a supporting browser",
    "verification": "See audit/API-AUDIT.md; availability is not verification"
  }
}
```

## Page guide

Remove the white, black or colored fringe left around a transparent cutout by taking the old background color back out of the soft edge pixels. Download the cleaned cutout as a PNG with a map of the pixels that changed.

How can we improve this tool?

Report a problem or share an idea.

Please leave out private information. Your message and the tool name go to our team via PostHog.

### How to use Edge halo cleanup

1. Choose a transparent PNG cutout.
2. Pick the matte color the cutout was originally on, such as white for a product shot on a white background.
3. Set how many pixels in from the transparent area to clean.
4. Run the tool, check the changed-pixel map and download your PNG.

## Useful next steps

- [Remove background](https://happytails.ai/en/image-tools/remove-background/) ([Markdown](https://happytails.ai/en/image-tools/remove-background.md))

- [Trim transparent image margins](https://happytails.ai/en/image-tools/transparent-image-trim/) ([Markdown](https://happytails.ai/en/image-tools/transparent-image-trim.md))

- [Split and combine image channels](https://happytails.ai/en/image-tools/image-channel-splitter/) ([Markdown](https://happytails.ai/en/image-tools/image-channel-splitter.md))

## How the fringe is removed

A soft edge pixel is a mix of the subject color and the old background: shown color = alpha x subject + (1 - alpha) x matte, the "over" operation from Porter and Duff, "Compositing Digital Images", SIGGRAPH 1984. The tool solves that equation for the subject color, F = (C - (1 - alpha) x M) / alpha, in encoded sRGB, and keeps the alpha value exactly as it was.

### Which pixels change

Only partly transparent pixels within the edge band of a fully transparent pixel are cleaned, measured in whole pixels including diagonals. Fully opaque and fully transparent pixels never change, and pixels below the lowest alpha setting are left alone because their color is too uncertain. The changed-pixel map shows every cleaned pixel in white.

### Limits of the method

The method assumes the cutout was made against one uniform matte color. Hair, smoke and motion blur shot against a busy background can lose detail or keep some fringe. Use PNG for exact results: browsers round partly transparent colors when they decode WebP or color-managed files.
