Advanced mask smoothing with dual-mode algorithm. 'Simple' mode uses uniform SDF blur for blob-like masks (upholstery, panels). 'Adaptive' mode preserves thin features while smoothing thick regions (furniture frames, complex shapes). Includes hole filling, speckle removal, corner compensation, and anti-aliased output ready for compositing.
One POST request. Get the result back directly — as an image, video, or JSON depending on the tool.
curl -X POST https://apiai.me/api/workflow/smooth-mask \
-H "X-API-Key: YOUR_API_KEY" \
-F "image=@input.jpg" \
-F "aa_edge_px=1.5" \
-F "expand_px=4" \
-F "fill_holes=true" \
-F "min_region_size=50" \
-F "mode=simple" \
-F "smooth_strength=1.0" \
-F "target_format=original"
--output result.png
Test this tool visually before writing any code. Upload an image, set parameters, and see the result live. When it looks right, copy the auto-generated curl command and paste it into your app.
Process hundreds of images at once without writing a loop. Upload a CSV with one row per item, set your parameters, and download the results as a ZIP when they're done.
| Name | Required | Description | Default / Options |
|---|---|---|---|
aa_edge_px |
optional | Anti-aliased edge width in pixels. Higher = softer edge. 0 = hard binary. | 1.5
|
expand_px |
optional | Pre-dilate the mask by N pixels before smoothing, so sharp corners aren't eaten by the SDF blur (prevents halos when the mask is used for compositing). Use 3-4 for blob masks, 0 for frame masks. | 4
|
fill_holes |
optional | Fill enclosed black holes inside the mask. 'true' or 'false'. Disable for masks with legitimate gaps (e.g. between chair legs). | true
|
min_region_size |
optional | Remove white speckle smaller than N pixels (px^2). 0 disables. | 50
|
mode |
required | 'simple' = single-sigma SDF blur for blob masks (fabric/cushions). 'adaptive' = spatially-varying blur that preserves thin features (frame/leg masks). | simpleadaptive
|
smooth_strength |
optional | Smoothing intensity 0..1 (default 1.0 = max). Simple mode: sigma up to 7.5 px. Adaptive mode: high_sigma up to 5 px (thin features stay at 1.5 px). | 1.0
|
target_format |
optional | Output aspect ratio. 'original' keeps input dimensions. Otherwise pads (no crop) to the given aspect — options: 1:1, 3:4, 4:3, 9:16, 16:9. The padded area is filled with 0 (outside the mask). | original1:13:44:39:1616:9
|
Get an API key, test Smooth mask in the dashboard, and copy the curl command.