Alpha Signed Distance Map Generator
Create an opaque grayscale PNG encoding signed nearest-opposite pixel-center distances from a local image alpha mask.
Loading tool…
How to use Alpha Signed Distance Map Generator
Create an opaque grayscale PNG encoding signed nearest-opposite pixel-center distances from a local image alpha mask. Prepare a bounded sampled distance texture for later graphics integration. Choose the alpha classification and distance spread explicitly, inspect the encoding model and retain an original-size PNG. The tool generates data pixels rather than executing a shader or inferring a vector glyph edge.
- Provide static alpha-mask image, foreground alpha strictly above cutoff, distance spread in source pixels.
- Choose the supported mode and run the tool. Review its assumptions and any reported errors.
- Copy the result or download a separate output; reset to clear the current form.
Good to know
- One static PNG, baseline JPEG or simple VP8/VP8L WebP up to 8 MiB, 1,000,000 pixels and 2,048 per side. Existing strict structure/CRC/dimension preflight precedes native decoding; animated/extended/progressive images, compressed PNG metadata and supplied SVG are refused.
- Alpha cutoff is exact plain integer digits 0–254; foreground means decoded alpha strictly greater than it. Spread is exact plain integer digits 1–128 source pixels. RGB colors do not enter the distance model. An opaque photo has no background class.
- For each source pixel, compute Euclidean distance to the nearest opposite-class pixel center inside the finite image grid. Foreground is positive and background negative. This is an exact squared discrete metric followed by a square root; it is not analytic distance to a continuous vector edge, an antialiased coverage reconstruction or a multi-channel glyph SDF.
- Output round(255 × (0.5 + clamp(distance, −spread, spread) ÷ (2 × spread))) as equal RGB channels and opaque alpha. There is no explicit zero-distance pixel between the two classes; the zero contour is inferred between samples. Quantization/clipping limits decoded precision. All-foreground and all-background inputs become 255 or 0, with that absent-opposite-class condition reported. Outside-canvas background is not invented.
- The separable exact squared EDT uses two linear row scans and a finite lower envelope of column parabolas for each class. Core arrays are bounded by 17 bytes per source pixel plus about 20 bytes per source row, including input/output RGBA, one grid and mask. Parent copies, native bitmap/canvas and codec buffers add separate overhead. Original pixels are copied before transfer.
- The same-origin Worker prepares within 10 seconds and gets a separate 2-second compute deadline. Output keeps the source dimensions; native PNG encoding waits at most 5 seconds and produces at most 8 MiB. Native decoding/encoding/color conversion can alter source samples or metadata and cannot always be forcibly interrupted. Resources are reset or closed on success and failure.
- Download signed-distance-map.png and review the textual scale report before using it in a shader/material/atlas. No user shader, HTML, SVG or source program runs. Later filtering, sampling scale, border policy, GPU interpretation, color management and visual integration require independent testing.
- 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
Is this the exact distance to my original vector glyph outline?
No. It measures between opposite alpha classes at decoded raster pixel centers inside this image. That explicit discrete model differs from an analytic vector contour or a continuous coverage model; use the reported spread and quantizer when interpreting the PNG.
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 →Heightmap to Normal Map Generator
Convert a selected height channel into an opaque tangent-style normal-map PNG.
ImagesPNG Drop Shadow Generator
Create a real expanded transparent PNG with a declared offset and finite box-blurred alpha shadow beneath the source.
ImagesTransparent Sprite Component Extractor
Separate alpha-connected regions into individually masked PNG cutouts and download a ZIP with original-coordinate evidence.
ImagesImage Palette Extractor
Estimate prominent image colors and their sampled pixel coverage locally.