ToolJovia
Images

Alpha Mask Refinement

Grow, shrink, open, close or box-feather an image alpha channel and export a separate PNG locally.

✓ Browser-local processing

Loading tool…

How to use Alpha Mask Refinement

Grow, shrink, open, close or box-feather an image alpha channel and export a separate PNG locally. Refine an existing cutout mask with an explicit integer-grid neighborhood. RGB samples from browser decoding remain unchanged in the computation; only opacity is transformed.

  1. Provide one static source image, square neighborhood radius in pixels.
  2. Choose the supported mode and run the tool. Review its assumptions and any reported errors.
  3. Copy the result or download a separate output; reset to clear the current form.

Good to know

  • One static PNG, baseline JPEG or simple WebP, at most 8 MiB, 1,000,000 pixels and 2,048 pixels per side, with strict structure/CRC preflight before decoding. APNG, progressive JPEG, extended/animated WebP, compressed PNG metadata and SVG/GIF are refused. Native orientation must preserve the declared dimensions.
  • The alpha-only square neighborhood is the discrete (2r + 1) × (2r + 1) integer-pixel window, with zero alpha outside the image. Radius is a canonical whole-number 0–16 (digits only); zero is identity. Dilate uses maximum alpha, Erode minimum, Open is Erode then Dilate and Close is Dilate then Erode. Each stage is cropped to the original dimensions, then zero-extended again; Close can therefore reduce border opacity. This finite-grid boundary model is not infinite-plane closing. This discrete sampling is not a claim of bit-identical SVG feMorphology rendering.
  • Feather takes the exact square-window alpha sum divided by the full window area, rounding once to the nearest integer. Outside-image samples are zero, so edge opacity can decrease. It is a box average, not a Gaussian, distance-field feather or intelligent edge decontamination.
  • Neighborhood work is bounded before allocation to 12,000,000 samples across both axes and all stages. Large images with large radii may be refused; reduce radius or resize first. Source and output dimensions stay the same.
  • Native decoding has a 10-second wait limit; the local module Worker has separate 10-second preparation and 2-second computation deadlines, and PNG encoding a 5-second wait limit. Native codec work cannot be forcibly aborted. Output PNG is capped at 8 MiB.
  • The computation retains browser-provided RGB samples, but native decoding/canvas premultiplication, color conversion and re-encoding can change hidden transparent colors. It cannot recover color outside a cutout, remove a matte, guarantee hair detail or preserve archival metadata. JPEG has no source alpha and therefore starts opaque.
  • Structured text output is limited to 500,000 characters. Reduce the supplied source when that separate output budget is exceeded.
  • Inputs are processed on this device and are not automatically saved or uploaded.

Common questions

Will dilation reconstruct missing edge colors?

No. The operation changes the existing alpha values on the fixed pixel grid. RGB is retained from the decoded source, including whatever the browser makes available at transparent pixels. Grow only as far as that source color supports, and inspect the PNG result.

Does this change my original input?

No. The tool returns a separate result. Review that output before using it in another application.

Keep going with related tools

All images →