DEV Community

Cover image for Bulk-remove backgrounds from product photos for Amazon and Shopify (white or transparent) without paying remove.bg prices
Fast Data
Fast Data

Posted on

Bulk-remove backgrounds from product photos for Amazon and Shopify (white or transparent) without paying remove.bg prices

If you sell on Amazon or Shopify, you know the chore: the supplier sends 300 photos on red, grey and yellow backgrounds, and the marketplace wants a clean white main image. Doing that by hand in Photoshop takes an afternoon. Doing it with a per-image API gets expensive fast.

This post shows the batch workflow I use: image URLs in, pure-white (or transparent) cut-outs out, then a few lines of Python to make them square. I ran everything below on 22 October 2026, and the numbers are from that run.

Disclosure: I built the Apify actor used here (AI Background Remover). I also list the free options I'd use instead in some cases.

What the marketplaces actually ask for

Amazon (main image). Amazon's product image requirements ask for a pure white background (RGB 255, 255, 255) on the main image, with the product filling about 85% of the frame. There must be no text, logos or watermarks, and the whole product must be visible. Rules differ by category, so check the current guide for yours.

Shopify. Shopify's product media documentation accepts images up to 5000 × 5000 px (20 megapixels, under 20 MB) and says square images of 2048 × 2048 px usually look best. White isn't required, but a consistent background across a collection looks much tidier.

So the job is: remove the background, put the product on exact #ffffff, crop close, leave a small margin and output a square image.

The test: three product photos

I used three product photos from Unsplash (free under the Unsplash License, with commercial use allowed): a red sneaker on red, two smartwatches on light grey and headphones on yellow. No people.

Original product photos next to the white-background output

Input:

{
  "imageUrls": [
    "https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=1200",
    "https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=1200",
    "https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=1200"
  ],
  "outputFormat": "jpg",
  "backgroundColor": "#ffffff",
  "cropToObject": true,
  "padding": 40
}
Enter fullscreen mode Exit fullscreen mode

Results of the run:

  • Run time: 29 s for the whole run, including container start. The model itself took 3.5 s, 4.1 s and 10.2 s per image (IS-Net model, 2 GB memory).
  • Output: one JPG per image, cropped to the product with a 40 px margin: 805×748, 1135×813 and 623×654 px.
  • Background check: I read the pixels back in Pillow. All corners and the whole margin are exactly (255, 255, 255), not "almost white".
  • Cost to a user: 3 images × $0.006 = $0.018.

Each result row looks like this:

{
  "sourceUrl": "https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=1200",
  "status": "ok",
  "outputUrl": "https://api.apify.com/v2/key-value-stores/.../records/nobg-00001.jpg?signature=...",
  "width": 805, "height": 748,
  "model": "isnet-general-use",
  "processingSeconds": 3.49
}
Enter fullscreen mode Exit fullscreen mode

Want transparency instead? Set "outputFormat": "png" (or webp for smaller files) and leave backgroundColor empty.

Step 1: one call with curl

You need a free Apify account and an API token. The synchronous endpoint returns the result rows directly:

curl -s -X POST \
  "https://api.apify.com/v2/acts/fast_data_asap~ai-background-remover/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"imageUrls":["https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=1200"],
       "outputFormat":"jpg","backgroundColor":"#ffffff","cropToObject":true,"padding":40}'
Enter fullscreen mode Exit fullscreen mode

Synchronous calls time out after 5 minutes, so use them for small batches only.

Step 2: batch from a CSV or Google Sheet

For hundreds of images, start a normal run and wait for it to finish. The script below reads a CSV that has an image_url column. A Google Sheet works too: share it as "anyone with the link" and use its CSV export URL.

# pip install apify-client pillow requests
import csv, io, os, requests
from apify_client import ApifyClient
from PIL import Image

SHEET_CSV = "https://docs.google.com/spreadsheets/d/<SHEET_ID>/export?format=csv"
rows = list(csv.DictReader(io.StringIO(requests.get(SHEET_CSV).text)))
urls = [r["image_url"] for r in rows if r.get("image_url")]

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("fast_data_asap/ai-background-remover").call(run_input={
    "imageUrls": urls,
    "outputFormat": "jpg",
    "backgroundColor": "#ffffff",
    "cropToObject": True,
    "padding": 40,
    "maxInputMegapixels": 8,   # keep more pixels for 2048 px output
})

os.makedirs("white", exist_ok=True)
for i, item in enumerate(client.dataset(run["defaultDatasetId"]).iterate_items()):
    if item["status"] != "ok":
        print("FAILED", item["sourceUrl"], item.get("error"))   # failed images are not charged
        continue
    img = Image.open(io.BytesIO(requests.get(item["outputUrl"]).content)).convert("RGB")
    # pad to a square, then scale to 2048 x 2048 for Shopify
    side = max(img.size)
    square = Image.new("RGB", (side, side), (255, 255, 255))
    square.paste(img, ((side - img.width) // 2, (side - img.height) // 2))
    square.resize((2048, 2048), Image.LANCZOS).save(f"white/{i:04d}.jpg", quality=92)
Enter fullscreen mode Exit fullscreen mode

Two notes from testing:

  • Frame fill: with crop-to-object plus a small padding (around 2–5% of the longest side), the product fills roughly 90% of the square, which meets Amazon's ~85%. Raise padding if a product looks cramped.
  • Resolution: the actor processes at up to 4 MP by default (about 2000 × 2000 px). After cropping, the product is smaller than that. If your sources are large, raise maxInputMegapixels (up to 16). If your sources are small, scaling to 2048 px won't add real detail.

What 500 images cost

Option 500 images Notes
This actor $3.00 $6 per 1,000, down to $4.50 per 1,000 ($2.25) on higher Apify plans. Failed images are free.
remove.bg pay-as-you-go $199 500-credit pack, 1 credit per full-resolution image (pricing, checked Oct 2026)
remove.bg subscriptions varies Cheaper per image at high volume (large plans work out to roughly $0.07/image), but it's a monthly commitment
rembg / BiRefNet locally $0 + your time Free, open-source, runs on your own machine

At ~4 s per image on one CPU core, 500 images take roughly 30–40 minutes. The faster u2net model is 2–3× quicker for simple products on plain backgrounds, at the same price.

The honest DIY alternative

If you're comfortable with Python, you may not need any API:

  • rembg (MIT): pip install "rembg[cpu]", then rembg i in.jpg out.png. It ships the same open-source IS-Net and U2-Net models this actor uses, so on one laptop the quality is the same and it's free.
  • BiRefNet (MIT) is a newer model. It's often better on fine detail, but heavier, and much happier with a GPU.

The hosted version is worth it when you don't want to maintain a Python environment, when the images are already URLs (supplier feeds, a Shopify export, a sheet), or when the job should run from Make, Zapier, n8n or a schedule.

Where it struggles

  • Transparent and glass products (bottles, glasses, clear packaging). The model has to decide whether the background seen through the glass belongs to the product, and it often gets that wrong. remove.bg's proprietary model also tends to do better here.
  • Hair, fur and fluffy textiles come out softer than a manual mask.
  • White products on white or light-grey backgrounds have low contrast. In my test the white watches came out fine, but check edges on light-on-light shots.
  • Shadows are removed. The headphones lost their contact shadow. That's what Amazon's main image wants, but some brands prefer a soft shadow for secondary images.
  • It can't fix framing. One watch in the original runs off the edge of the photo, and it stays cut off. Amazon wants the whole product visible, so reshoot those.

Always skim the batch before uploading. A contact sheet of thumbnails takes a minute and catches the few bad masks.

Try it

AI Background Remover on Apify: paste URLs in the console, or use the API calls above. The Apify free plan's monthly credit covers a few hundred test images.

Top comments (0)