API reference/POST /shadow

Drop shadow composite

Cut out the subject and composite it back onto a transparent (or colored) background with a drop shadow — adjustable angle, blur, opacity, and color.

POSThttps://useknockout--api.modal.run/shadow

Parameters

Send as multipart/form-data unless noted otherwise.

filerequiredfileImage to process. JPG, PNG, WebP, HEIC. Up to 10 MB and 4096×4096.
angleint 0-360135Shadow angle in degrees. 0 = right, 90 = down.
blurint 0-10020Gaussian blur radius in pixels.
opacityfloat 0-10.4Shadow alpha.
colorstring#000000Shadow hex color.
offsetint12Pixel distance shadow is offset from subject.

Request

curl -X POST "https://useknockout--api.modal.run/shadow" \
  -H "Authorization: Bearer $TOKEN" \
  -F "file=@cat.jpg" \
  -F "blur=24" -F "opacity=0.35" \
  -o out.png

Response

HTTP/1.1 200 OK
content-type: image/png
content-length: 254312
x-knockout-latency: 184
x-knockout-model: BiRefNet
x-ratelimit-limit: 60
x-ratelimit-remaining: 59

Errors

401unauthorizedMissing or invalid token.
402payment_requiredFree tier exhausted. Add a card to continue.
413payload_too_largeImage exceeds 10 MB or 4096×4096.
422no_subject_detectedForeground could not be isolated from background.
429rate_limit_exceededSlow down. Retry-After header tells you when.
500internal_errorSomething broke on our side. Include request_id when reporting.
Every error response also includes a request_id in the JSON body. Quote it when reporting issues.