Skip to content

v0.8.0 — /inpaint via LaMa

Choose a tag to compare

@TroyJLorents-GH TroyJLorents-GH released this 12 May 21:42
· 39 commits to main since this release

Added

  • POST /inpaint — large-mask inpainting via LaMa (Apache-2.0) through the simple-lama-inpainting wrapper. Resolution-robust, deterministic, no prompts. Three auto-detected input modes:

    1. auto-subject (no mask, no bbox) — BiRefNet derives the subject mask, inverts it. Drop in a photo, get the subject erased.
    2. mask — user-supplied PNG mask (white = inpaint, black = keep).
    3. bbox — send x, y, w, h form fields, server synthesizes a rectangular mask.
  • Optional dilation param (default 8, range 0..32) expands the mask before inpainting to eliminate ghost outlines from tight masks.

How it works

Pipeline preserves full input resolution: dilate mask → downscale to 1024 max-edge → run LaMa → upscale result → composite over the original so unmasked pixels stay byte-identical to input. Same trick used by lama-cleaner.

Demo

curl -X POST "https://useknockout--api.modal.run/inpaint" \
  -H "Authorization: Bearer kno_public_beta_4d7e9f1a3c5b2e8d6a9f7c1b3e5d8a2f" \
  -F "file=@photo.jpg" \
  -o erased.png

That's auto-subject mode — drop in any photo, get the subject removed. To target a specific region:

# bbox
curl ... -F "x=100" -F "y=100" -F "w=300" -F "h=400"

# user-supplied mask
curl ... -F "mask=@my-mask.png"

Response headers

  • x-knockout-model: big-lama
  • x-knockout-mode: auto-subject | mask | bbox
  • x-knockout-warning: <text> when mask covers >50% of the image (LaMa quality degrades on huge masks)

Endpoint count

23 endpoints in one image API (was 22).

Full changelog: v0.7.1...v0.8.0