A highly scalable async API for background removal, intelligent trimming, and image enhancement.
We use an async event-driven architecture to ensure large files or complex ML models never timeout. All operations follow this flow:
Send your image to the processing endpoint. Receive a jobId instantly.
Check the status endpoint periodically (e.g., every 2s) until the job reads as "completed".
Download the processed image base64 or optimized URL from the result endpoint.
async function processImage(endpoint, file) {
const formData = new FormData();
formData.append("image", file);
// 1. Submit job
const { statusUrl, resultUrl } = await (
await fetch(endpoint, { method: "POST", body: formData })
).json();
// 2. Poll until done
let status;
do {
await new Promise((r) => setTimeout(r, 2000));
status = await (await fetch(statusUrl)).json();
} while (status.status === "processing");
// 3. Get result
if (status.status === "completed") {
const result = await (await fetch(resultUrl)).json();
return result.image;
}
}Automatically crops completely transparent or solid white edges from subjects. Uses native hardware acceleration.
{
"success": true,
"jobId": "740cbe8d-9f5a-4424-99a3-0d926e9eec00",
"status": "processing",
"message": "Trim job started. Poll the status URL to check progress.",
"statusUrl": "https://api.trimforge.com/api/jobs/740cbe8d-.../status",
"resultUrl": "https://api.trimforge.com/api/jobs/740cbe8d-.../result"
}AI-powered isolation of primary subjects. Runs on isolated GPU clusters via ONNX Runtime.
{
"success": true,
"jobId": "5137cff4-87f7-4337-955d-4ecc7f1ce89b",
"status": "processing",
"message": "Background removal started. Poll the status URL to check progress.",
"statusUrl": "https://api.trimforge.com/api/jobs/5137cff4-.../status",
"resultUrl": "https://api.trimforge.com/api/jobs/5137cff4-.../result"
}Programmatically adjust exposure, contrast, saturation, and apply unsharp masking.
| Field | Type | Default | Description |
|---|---|---|---|
| image | File | Required | The image to enhance |
| sharpen | Text | 1.5 | Sharpening strength (sigma) |
| brightness | Text | 1.05 | Multiplier (1.0 = no change) |
| saturation | Text | 1.15 | Multiplier (1.0 = no change) |
Use the endpoints returned in your initial request to poll for and retrieve the final payload.
{
"success": true,
"jobId": "5137cff4-...",
"type": "enhance",
"status": "completed", // 'processing', 'completed', 'failed'
"resultUrl": "https://api.trimforge.com/api/jobs/5137cff4-.../result"
}{
"success": true,
"jobId": "5137cff4-...",
"type": "enhance",
"filename": "enhanced-photo.png",
"mimeType": "image/png",
"size": 2424283,
"image": "data:image/png;base64,iVBORw0KGgo..."
}