If you manage a large product catalog, manually uploading and downloading images in Studio is usually too slow. The most scalable approach is to automate background removal through the BackgroundErase API, then route the processed assets into your catalog pipeline, CMS, storefront, or DAM.
Best fit: This workflow is ideal for marketplaces, product catalogs, fashion listings, reseller feeds, and any team processing product images in batches or continuously.
Why automate?
Automation becomes valuable as soon as you have dozens, hundreds, or thousands of product images to process. Instead of relying on a person to upload each file one at a time, you can let your systems send images directly to the API and store the outputs automatically.
- Remove repetitive manual work
- Keep listing imagery visually consistent
- Speed up onboarding of new SKUs
- Process new product photos as soon as they arrive
- Plug the results into existing catalog tools
Recommended workflow
At a high level, most e-commerce automation setups follow this pattern:
- Upload raw catalog images to your intake folder or storage bucket
- Send each image to BackgroundErase through the API
- Save the PNG cutout or flattened JPG/WebP result
- Push the processed assets into your CMS, PIM, DAM, or storefront
- Keep the original image plus processed version for re-runs if needed
Start with a single API request
Before building full automation, test one product image end to end:
curl -H 'x-api-key: YOUR_API_KEY' \
-f https://api.backgrounderase.com/v2 \
-F 'image_file=@/absolute/path/to/product.jpg' \
-F 'format=png' \
-F 'size=full' \
-o output.pngThis returns a PNG cutout. From there, you can decide whether your catalog should store:
- A transparent PNG for flexible reuse
- A flattened JPG with a white background
- A WebP result for smaller file sizes on the web
Batch processing in Python
A simple way to automate a folder of product images is to loop through your input directory and call the API for each file:
from pathlib import Path
import http.client
import mimetypes
import os
import uuid
API_KEY = "YOUR_API_KEY"
INPUT_DIR = "./catalog-input"
OUTPUT_DIR = "./catalog-output"
def remove_background(src_path, dst_path):
fname = os.path.basename(src_path)
ctype = mimetypes.guess_type(src_path)[0] or "application/octet-stream"
boundary = "----%s" % uuid.uuid4().hex
crlf = "\r\n"
with open(src_path, "rb") as f:
file_bytes = f.read()
body = (
f"--{boundary}{crlf}"
f'Content-Disposition: form-data; name="image_file"; filename="{fname}"{crlf}'
f"Content-Type: {ctype}{crlf}{crlf}"
).encode() + file_bytes + f"{crlf}--{boundary}--{crlf}".encode()
headers = {
"Content-Type": f"multipart/form-data; boundary={boundary}",
"x-api-key": API_KEY,
"Content-Length": str(len(body)),
}
conn = http.client.HTTPSConnection("api.backgrounderase.com")
conn.request("POST", "/v2", body=body, headers=headers)
resp = conn.getresponse()
out = resp.read()
if resp.status == 200:
with open(dst_path, "wb") as f:
f.write(out)
print("Saved:", dst_path)
else:
print("Failed:", src_path, resp.status, resp.reason, out.decode(errors="ignore"))
conn.close()
Path(OUTPUT_DIR).mkdir(parents=True, exist_ok=True)
for path in Path(INPUT_DIR).iterdir():
if path.suffix.lower() in {".jpg", ".jpeg", ".png", ".webp", ".heic", ".heif"}:
dst = Path(OUTPUT_DIR) / f"{path.stem}.png"
remove_background(str(path), str(dst))Batch processing in Node.js
If your catalog tooling already runs in Node.js, you can do the same thing with a simple loop:
const fs = require("fs");
const path = require("path");
const backgroundRemoval = require("./backgroundRemoval");
const inputDir = "./catalog-input";
const outputDir = "./catalog-output";
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}
(async () => {
const files = fs.readdirSync(inputDir);
for (const file of files) {
const ext = path.extname(file).toLowerCase();
if (![".jpg", ".jpeg", ".png", ".webp", ".heic", ".heif"].includes(ext)) continue;
const src = path.join(inputDir, file);
const dst = path.join(outputDir, path.parse(file).name + ".png");
try {
await backgroundRemoval(src, dst);
console.log("Processed:", file);
} catch (err) {
console.error("Failed:", file, err);
}
}
})();Best practices for e-commerce catalogs
- Store the original image and the processed output separately
- Use high-quality source files for cleaner edges
- Prefer tight, near-square framing when possible
- Standardize your chosen output format across the catalog
- Run quality checks on a sample set before bulk rollout
- Use transparent PNG when assets may be reused across multiple backgrounds
- Use JPG with a white background when your storefront requires opaque listing images
Tip: For product catalogs, automation works best when you define a repeatable intake format, output format, and naming convention before processing thousands of images.
When to move to Enterprise
If you are processing very large volumes, need custom rate limits, want lower per-image pricing, or need custom workflows for your category of products, Enterprise may be the better fit.
This is especially relevant if you want:
- Millions of processed images per year
- Private or self-hosted deployment options
- Custom model tuning for your catalog imagery
- Procurement, SLA, or compliance support
