How to clean up car inventory photos in bulk via API

Automate background removal for dealership and automotive inventory photos at scale using the BackgroundErase API.

Jack
Written by Jack
Updated in March 2026

If you manage automotive inventory, manually cleaning vehicle photos one by one is usually too slow. The most scalable workflow is to automate background removal through the BackgroundErase API, then route the finished images into your inventory platform, VDP pages, CMS, or dealership website.

Best fit: This workflow is ideal for dealerships, used-car marketplaces, vehicle exporters, auction feeds, and internal teams processing large numbers of car photos every day.


Why automate car photo cleanup?

Automotive inventory photos often arrive in large batches and need to be cleaned quickly so listings look consistent across your website and ad channels. Automating background removal helps standardize presentation without requiring a person to manually upload, edit, and download each image.

  • Speed up publishing of new vehicles
  • Keep listing imagery visually consistent
  • Reduce manual editing time for photo teams
  • Process new arrivals in batches
  • Push finished photos directly into your dealer or inventory system

Recommended workflow

Most automotive photo pipelines follow a pattern like this:

  1. Export raw vehicle photos from your intake system, CRM, or camera workflow
  2. Send each image to BackgroundErase through the API
  3. Save the processed PNG or flattened JPG/WebP output
  4. Push the cleaned images into your inventory platform, CMS, or dealer website
  5. Keep the original photos so you can rerun jobs if your standards change

Start with one vehicle photo

Before automating an entire inventory feed, test a single image end to end:

curl -H 'x-api-key: YOUR_API_KEY' \
-f https://api.backgrounderase.com/v2 \
-F 'image_file=@/absolute/path/to/car.jpg' \
-F 'format=png' \
-F 'size=full' \
-o output.png

This returns a PNG cutout. Depending on your listing standards, you may choose to store:

  • A transparent PNG for design flexibility
  • A flattened JPG against a white or branded background
  • A WebP result for smaller file sizes on web inventory pages

Batch processing in Python

If your automotive workflow already relies on Python scripts or scheduled jobs, a simple folder-based loop is an easy place to start:

from pathlib import Path
import http.client
import mimetypes
import os
import uuid

API_KEY = "YOUR_API_KEY"
INPUT_DIR = "./car-inventory-input"
OUTPUT_DIR = "./car-inventory-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 dealership tools or backend systems already run in Node.js, you can automate the same workflow with a simple queue:

const fs = require("fs");
const path = require("path");
const backgroundRemoval = require("./backgroundRemoval");

const inputDir = "./car-inventory-input";
const outputDir = "./car-inventory-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 vehicle photos

Car inventory images can be more challenging than simple product packshots because vehicles are reflective, glossy, and often photographed outdoors. Good source images make a big difference.

  • Use the highest-quality source files available
  • Keep the vehicle large in frame
  • Prefer near-square framing when possible
  • Avoid heavy motion blur or low-resolution dealer feed exports
  • Use consistent photo standards across your inventory team
  • Keep originals so you can rerun processing later

Tip: Exterior side views, front three-quarter views, and well-lit studio or lot photos usually produce the most consistent results.

Where this fits in a dealership workflow

Most teams place automated cleanup between image intake and listing publication. For example:

  • Photo booth or mobile capture app uploads raw photos
  • A job runner sends them to BackgroundErase
  • Processed outputs are saved to storage or a DAM
  • Your inventory or website platform pulls the final versions automatically

When to move to Enterprise

If you process very large volumes of vehicle images, need lower per-image pricing, or want custom workflow support, Enterprise may be the better fit.

  • Millions of vehicle images per year
  • Custom model tuning for automotive imagery
  • Private deployment or self-hosted requirements
  • Procurement, SLA, or compliance support