Guides

Composition JSON

Reference schema for composition payload used by /v1/jobs/{job_id}/start.

Schema Overview

Composition controls foreground placement on the output canvas.

Use this payload when you want deterministic positioning and model-safe defaults for enterprise workflows.

{
  "composition": {
    "canvas": { "width": 1920, "height": 1080 },
    "foreground": {
      "anchor": "center",
      "scale": 1,
      "offset": { "x": 0, "y": 0 }
    }
  }
}

Field Reference

FieldTypeDescription
canvas.widthnumberOutput width in pixels
canvas.heightnumberOutput height in pixels
foreground.anchorstringAnchor point, e.g. center, top-left
foreground.scalenumberForeground scaling ratio
foreground.offset.x/ynumberPixel offset from anchor

Background Types

typeRequired FieldsNotes
transparentnoneUse WebM/MOV/GIF/WebP/PNG sequence for alpha
colorcolor (hex or RGB normalized)Best for MP4 exports
imageimage_urlMatch aspect ratio to avoid stretching

Full Start Payload Example

curl -X POST https://api.removebgvideo.com/v1/jobs/{JOB_ID}/start \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "pro",
    "text_prompt": "person, clothing accessories, glowing ring",
    "background": { "type": "transparent" },
    "composition": {
      "canvas": { "width": 1920, "height": 1080 },
      "foreground": {
        "anchor": "center",
        "scale": 1,
        "offset": { "x": 0, "y": 0 }
      }
    }
  }'

Quality Guardrails

  • Prefer representative source clips when tuning model defaults.
  • Keep input compression moderate to preserve edge details.
  • Use explicit output format policy for transparent vs non-transparent workflows.
  • Run A/B validation with the same clip set before changing defaults.

Implementation Checklist

  1. Define payload schema validation in backend before forwarding requests.
  2. Store model/output_format/background settings with each job record.
  3. Add internal quality review for difficult scenes (hair, glass, motion blur).
  4. Create runbook entries for model-specific failure cases.

Anchor Behavior Guidance

AnchorTypical UseRisk
centerGeneral subject centeringCan crop tall subjects if scale too high
top-leftUI-like fixed placementLess natural for portrait content
bottom-centerTalking head over lower thirdCan overlap caption area

Composition Validation Rules

  • Require canvas width/height > 0 and reasonable aspect ratio.
  • Constrain scale to safe range (e.g. 0.1 - 3.0) in your backend.
  • Clamp offset values to avoid moving subject outside visible frame.