High-volume ecommerce platforms and marketplace aggregators face a persistent operational bottleneck when onboarding product catalogs: supplier images arrive in mismatched aspect ratios, noisy environments, and low-contrast lighting. While desktop bulk-editing applications exist, they require manual operator handling and cannot interface directly with internal Enterprise Resource Planning (ERP), Product Information Management (PIM), or Content Management Systems (CMS). Manual retouching teams create turnaround lags of 24 to 72 hours, driving up processing costs per SKU.
Cutout.pro offers a dedicated computer vision REST API designed for automated background removal, subject cropping, and solid color replacement. Integrating this API into an automated worker pipeline allows technical teams to standardize incoming product imagery in seconds, converting raw supplier photos into marketplace-compliant catalog assets on white backgrounds (#FFFFFF) with uniform margins and realistic contact shadows.
1. Cutout.pro API Architecture & Authentication
Cutout.pro exposes its core computer vision features via HTTPS endpoints. Authentication is uniform across all requests: developers must supply an API key in the custom HTTP header APIKEY.
APIKEY: your_cutout_pro_api_key_here
Pre-Flight Account & Credit Monitoring
Because bulk SKU ingestion pipelines can process tens of thousands of images in a single batch, pipelines must monitor account balance to avoid failing halfway through an ingest job with error code 4001 (Insufficient credits).
Cutout.pro provides a dedicated account balance check endpoint:
- Endpoint:
GET https://www.cutout.pro/api/v1/mySubscription - Headers:
APIKEY: <YOUR_API_KEY>,Accept: application/json
The JSON response returns real-time credit metrics:
{
"code": 0,
"data": {
"monthBalance": 1250,
"imageBalance": 5000,
"videoBalance": 0,
"monthStartDate": "2026-10-01 00:00:00",
"monthExpireDate": "2026-11-01 00:00:00"
},
"msg": null,
"time": 1728729600000
}
Integrating a pre-flight quota check into your ingestion orchestrator ensures that batch jobs pause and notify procurement before invoking thousands of paid API calls.
2. Choosing the Right Endpoint and Matting Mode
For product background removal, Cutout.pro specifies mattingType=6 (general cutout covering products, merchandise, and objects) or mattingType=1. The API offers three distinct integration modes depending on where your raw assets live and how your backend handles payloads.
| Mode | Endpoint | Request Method & Content-Type | Response Payload | Best Use Case |
|---|---|---|---|---|
| Mode 1: Binary Stream | https://www.cutout.pro/api/v1/matting | POST / multipart/form-data | Raw binary image (image/png) | Direct disk writes or in-memory byte buffers |
| Mode 2: Base64 JSON | https://www.cutout.pro/api/v1/matting2 | POST / multipart/form-data | JSON with data.imageBase64 | Microservices communicating via JSON RPC |
| Mode 3: By Image URL | https://www.cutout.pro/api/v1/mattingByUrl | GET / query string | JSON with data.imageBase64 | Assets already hosted on Amazon S3, Cloudflare R2, or CDN |
Critical Query & Body Parameters for Ecommerce
When configuring the matting request, several parameters control the geometry and background fill:
mattingType(integer, required): Set to6for general ecommerce product cutout.crop(boolean, optional): Set totrueto trim away empty transparent borders and fit tightly around the product bounding box.cropMargin(string, optional): Specifies margin around the cropped subject whencrop=true. Accepts absolute values like"30px"or relative percentages like"10%". Can take single, dual, or 4-side padding.bgcolor(hex string, optional): Replaces transparent areas with a solid hex color code (e.g.,FFFFFFfor pure white). Note: Do not prefix with#.outputFormat(string, optional): Supportspng,webp, orjpg_<quality>(such asjpg_85).preview(boolean, optional): Set totrueto process an image capped at 500x500 pixels. Preview calls cost only 0.25 credit, whereas full-resolution calls (up to 4096x4096px, <15MB) cost 1 credit. This is ideal for initial seller staging previews.
3. High-Throughput Batch Processing & Asynchronous Queue Architecture
The Cutout.pro API processes requests synchronously: each HTTP connection blocks until the server isolates the subject and returns the image or error payload. However, Cutout.pro enforces a strict rate limit of 5 simultaneous requests per second (5 QPS).
Sending uncontrolled concurrent requests results in error code 5005 (Too many requests in the queue, please wait). To process catalogs of 10,000+ SKUs safely and reliably, developers should isolate the API calls behind an asynchronous message queue.
Architectural Blueprint
[ERP / PIM Ingestion]
│ (Submit SKU Job Batch)
▼
[Message Broker: Redis / RabbitMQ]
│
▼
[Worker Pool (Celery / BullMQ)]
├── Token-Bucket Rate Limiter (Capped at 4.5 QPS)
├── Cutout.pro REST API (POST /api/v1/matting?mattingType=6)
│ └── Exponential Backoff on 5005
├── Post-Processing Engine (Pillow / Sharp)
│ ├── Center on Square Canvas (e.g., 2000x2000)
│ ├── 85% Frame Fill Factor
│ └── Realistic Contact Shadow Generation
├── Cloud Storage Upload (AWS S3 / Cloudflare R2)
└── Webhook Callback to ERP (Update SKU Status)
Rate Limiting and Resilience Strategy
- Token Bucket Rate Limiting: Configure worker nodes so that total outbound requests across the entire cluster never exceed 4.5 requests per second.
- Error Code Dispatching:
5005(Queue Full / QPS Exceeded): Implement exponential backoff with jitter (initial delay 1.5s, multiplying by 2 up to 3 retries).1002(File Exceeds 15MB) /5008(Unrecognized Image): Route the item directly to a dead-letter queue (DLQ) and flag the SKU for manual media inspection.4001(Insufficient Balance): Pause the queue processing worker and fire an urgent webhook alert to the administrative team.
4. End-to-End Image Standardization Pipeline
While Cutout.pro can return an image with a solid white background (bgcolor=FFFFFF), major marketplaces like Amazon, Google Shopping, and Shopify have strict geometric rules:
- The canvas must be square (e.g., 1:1 aspect ratio, 2000x2000px).
- The product must occupy 80% to 85% of the total frame area.
- A pure cut-and-paste white background often leaves products looking like floating, artificial decals. Generating a subtle, soft ground shadow creates depth and tactile credibility.
The standard pattern is to request a transparent PNG (crop=true without bgcolor), then standardize geometry and inject a contact shadow in the local worker using a fast graphics library like Python Pillow or Node.js Sharp.
Production Pipeline Example (Python & Pillow)
The following production script demonstrates how an automated worker ingests a raw supplier photo, requests a cropped transparent cutout from Cutout.pro, formats it onto a standard 2000x2000 white square canvas, generates an adaptive ground contact shadow, and exports an optimized JPEG.
import io
import time
import requests
from PIL import Image, ImageFilter, ImageOps
CUTOUT_API_KEY = "YOUR_API_KEY_HERE"
API_URL = "https://www.cutout.pro/api/v1/matting?mattingType=6&crop=true"
def remove_background(image_bytes: bytes, max_retries: int = 3) -> bytes:
"""Invokes Cutout.pro API with exponential backoff on rate limits."""
headers = {"APIKEY": CUTOUT_API_KEY}
files = {"file": ("product.jpg", image_bytes, "image/jpeg")}
for attempt in range(max_retries):
response = requests.post(API_URL, headers=headers, files=files, timeout=30)
if response.status_code == 200 and response.headers.get("Content-Type", "").startswith("image/"):
return response.content
# Check for JSON error responses
try:
error_data = response.json()
code = error_data.get("code")
msg = error_data.get("msg")
if code == 5005: # Rate limit exceeded
wait_time = (2 ** attempt) + 0.5
time.sleep(wait_time)
continue
elif code == 4001:
raise RuntimeError("Cutout.pro API credit balance exhausted.")
else:
raise ValueError(f"Cutout.pro processing failed: {code} - {msg}")
except requests.exceptions.JSONDecodeError:
response.raise_for_status()
raise TimeoutError("Exceeded maximum retries calling Cutout.pro API.")
def standardize_product_image(
transparent_png_bytes: bytes,
target_canvas_size: int = 2000,
fill_ratio: float = 0.85
) -> Image.Image:
"""
Standardizes image onto a square pure white canvas, scales product to fill 85%
of the frame, and generates an authentic ground contact shadow.
"""
# 1. Load cropped product
product = Image.open(io.BytesIO(transparent_png_bytes)).convert("RGBA")
prod_w, prod_h = product.size
# 2. Scale product maintaining aspect ratio to fit fill_ratio
max_dim = int(target_canvas_size * fill_ratio)
scale = min(max_dim / prod_w, max_dim / prod_h)
new_w, new_h = int(prod_w * scale), int(prod_h * scale)
product_resized = product.resize((new_w, new_h), Image.Resampling.LANCZOS)
# 3. Create square white canvas
canvas = Image.new("RGBA", (target_canvas_size, target_canvas_size), (255, 255, 255, 255))
# 4. Synthesize soft ground shadow
# Flatten alpha channel to create shadow mask
alpha_mask = product_resized.split()[3]
shadow_height = max(10, int(new_h * 0.08))
# Compress alpha vertically to create flat grounding footprint
shadow_footprint = alpha_mask.resize((new_w, shadow_height), Image.Resampling.BILINEAR)
shadow_footprint = shadow_footprint.filter(ImageFilter.GaussianBlur(radius=15))
# Build semi-transparent dark shadow image
shadow_layer = Image.new("RGBA", (new_w, shadow_height), (40, 40, 40, 0))
# Dampen shadow opacity to 35%
shadow_alpha = shadow_footprint.point(lambda p: int(p * 0.35))
shadow_layer.putalpha(shadow_alpha)
# 5. Composite elements onto canvas
pos_x = (target_canvas_size - new_w) // 2
pos_y = (target_canvas_size - new_h) // 2
# Paste shadow slightly below the product base
shadow_y = pos_y + new_h - int(shadow_height * 0.6)
canvas.paste(shadow_layer, (pos_x, shadow_y), shadow_layer)
# Paste product foreground
canvas.paste(product_resized, (pos_x, pos_y), product_resized)
# Convert to standard RGB JPEG asset
return canvas.convert("RGB")
def process_sku_pipeline(raw_image_path: str, output_path: str):
with open(raw_image_path, "rb") as f:
raw_bytes = f.read()
# Step 1: Remote matting via Cutout.pro
cutout_bytes = remove_background(raw_bytes)
# Step 2: Local geometry standardization and shadow generation
final_image = standardize_product_image(cutout_bytes)
# Step 3: Save optimized master asset
final_image.save(output_path, "JPEG", quality=90, optimize=True)
5. Production Best Practices & Cost Optimization
- Leverage
mattingByUrlto Minimize Egress Costs: If your raw images are already stored in an S3 bucket or CDN, callhttps://www.cutout.pro/api/v1/mattingByUrl?mattingType=6&url=<PUBLIC_URL>instead of uploading 10MB multipart payloads. This saves server egress bandwidth and eliminates upload latency. - Implement Two-Tier Quality Stages:
- Run the vendor onboarding stage using
preview=true(costs 0.25 credit). Display these in merchant staging dashboards for visual sign-off. - Trigger full-resolution 1-credit matting calls only when products transition to the active catalog state.
- Run the vendor onboarding stage using
- Persist Cutout Masks Separately: Store the raw transparent cutout PNG in your archival bucket alongside the final composed JPEG. If marketplace requirements change in the future (e.g., changing from pure white
#FFFFFFto light gray#F5F5F5or modifying margins from 85% to 90%), you can regenerate standard assets instantly without re-invoking the paid Cutout.pro API.