Removing a background is only the first decision in a product image workflow. The best output depends on where the image will be published and whether another system needs to place the product on a new surface later.
Quick decision guide
If you only need the short answer, match the destination to the output below. The sections that follow explain the reasoning and the edge cases.
| Destination | Recommended output | Why |
|---|---|---|
| Marketplace main image | White (RGB 255, 255, 255), flattened | Many marketplaces require pure white for the main image; check each one's current rules |
| Your own storefront theme | Transparent PNG or WebP | The theme controls the background and can change without reprocessing |
| Product cards on colored sections | Transparent | One asset works on every section color |
| Social posts and ads | Brand color or gradient, flattened | Most ad and social placements do not show transparency |
| Email newsletters | Flattened onto the email background color | Email client support for transparency varies |
| Print and PDF catalogs | Transparent master, flattened in the layout tool | The designer controls the final composite |
| Archive and future redesigns | Transparent PNG | Lossless and reusable |
Use transparency as the source asset
A transparent PNG is the most flexible result. It lets a storefront, design tool, or ad system choose the final background at render time. Keep this version as your master asset when the same product will appear across multiple channels.
- Best for reusable catalog assets and compositing.
- Works well for logos, product cards, and custom store themes.
- Preserves flexibility for later color or gradient changes.
Use white for marketplace listings
Some marketplaces require the main product image to use a pure white background. A white composite is also useful when the destination does not support alpha transparency or when consistent thumbnails matter more than design flexibility.
import requests
with open("product.jpg", "rb") as image_file:
response = requests.post(
"https://fapihub.com/v2/rembg/color/",
headers={"ApiKey": "YOUR_API_KEY"},
files={"image": image_file},
data={"bgcolor": "(255, 255, 255, 255)"},
timeout=30,
)
response.raise_for_status()
with open("product-white.png", "wb") as out:
out.write(response.content)Use brand colors for campaigns
Social posts, promotional tiles, and seasonal landing pages often need a stronger visual treatment. Send the original image to the color or gradient endpoint for each channel-specific version, or composite your stored transparent cutout onto a new background yourself (for example with Pillow or Sharp) when you want to avoid an extra API request per variant.
Watch for halos and edges
Light objects against light backgrounds and fine details such as hair, fur, or transparent packaging need extra review. Inspect the edge at 100% zoom, especially when moving a cutout from a dark preview to a white marketplace background. Consistent lighting and a sharp source image improve results more than simply increasing output dimensions.
Choose the right file format
Transparency lives in the image's alpha channel, and not every format has one. Saving a cutout in the wrong format is the most common way a good result gets ruined after processing.
| Format | Alpha channel | Best use |
|---|---|---|
| PNG | Yes, lossless | Master cutouts, logos, anything you will edit again |
| WebP | Yes, lossy or lossless | Web delivery of transparent product images at smaller file sizes |
| JPEG | No | Final flattened images for marketplaces, ads, and email |
FAPIhub returns a PNG with transparency preserved, so the master asset is already in the right format. If you need JPEG for a marketplace, flatten onto white before converting. Converting a transparent PNG straight to JPEG simply drops the alpha channel, and the color hidden under fully transparent pixels shows through, which is often black or noisy rather than white.
Create the white version from your transparent master
The color endpoint shown above is the simplest route when you only need a white image. If you already store the transparent cutout, you can build the white version locally and skip a second request. This also lets you control padding and canvas size consistently across a catalog.
from PIL import Image
def flatten_on_white(cutout_path, output_path, canvas=2000, fill=0.85):
cutout = Image.open(cutout_path).convert("RGBA")
cutout = cutout.crop(cutout.getbbox()) # trim transparent margins
scale = (canvas * fill) / max(cutout.size)
size = (round(cutout.width * scale), round(cutout.height * scale))
cutout = cutout.resize(size, Image.LANCZOS)
background = Image.new("RGB", (canvas, canvas), (255, 255, 255))
offset = ((canvas - size[0]) // 2, (canvas - size[1]) // 2)
background.paste(cutout, offset, mask=cutout)
background.save(output_path, "JPEG", quality=92)
flatten_on_white("product-cutout.png", "product-white.jpg")The mask=cutout argument uses the alpha channel for blending, so semi-transparent edge pixels mix smoothly into white instead of leaving a hard outline. Adjust fill to the framing rules of each destination. For marketplace-specific requirements, see our Amazon white background guide.
Gradients and shadows as a middle ground
A flat white background can look sterile on a storefront, while full lifestyle compositing takes more work. A soft gradient or a drop shadow gives a product depth and still keeps the catalog consistent. Both are single requests:
# Subtle top-to-bottom gradient
curl -X POST https://fapihub.com/v2/rembg/gradient/ \
-H "ApiKey: $FAPIHUB_API_KEY" \
-F "image=@product.jpg" \
-F "top_color=(255, 255, 255, 255)" \
-F "bottom_color=(235, 238, 242, 255)" \
--output product-gradient.png
# Transparent cutout with a soft drop shadow
curl -X POST https://fapihub.com/v2/rembg/shadow/ \
-H "ApiKey: $FAPIHUB_API_KEY" \
-F "image=@product.jpg" \
-F "shadow_color=(0, 0, 0, 150)" \
-F "offset=(10, 10)" \
-F "blur_radius=15" \
--output product-shadow.pngShadows help products that look like they are floating on a white page, such as shoes, bottles, and boxed goods. Our product shadow guide covers parameter choices in more detail, and the background color guide covers solid colors.
Common mistakes
- Off-white backgrounds. A background of 250 or 254 looks white on screen but fails a strict pure-white check. Use exactly
(255, 255, 255, 255)and avoid color-managed exports that shift it. - Flattening too early. Once a cutout is composited onto white, you cannot cleanly move it to a dark theme later. Keep the transparent master.
- Inconsistent framing. Products that fill different amounts of the canvas look disorganized in a grid. Crop to the subject's bounding box and apply the same fill ratio to every image.
- Re-compressing repeatedly. Each JPEG save loses detail. Generate every derivative from the PNG master, not from another derivative.
- Testing only on white. A transparent image previewed only on a white page hides light fringes that show up on a dark theme.
What the derivatives cost
Every API call is one request, and the color, gradient, and shadow endpoints cost the same per request as plain removal on every plan. That gives you two approaches for a catalog of 1,000 products:
| Approach | Requests | Plan that covers it |
|---|---|---|
| Transparent master from the API, white and color versions composited locally | 1,000 | Per Usage, $10 one-time |
| Transparent, white, and gradient versions each from the API | 3,000 | Pro, $15/month (7,500 requests) |
| Same three versions for 3,000 products | 9,000 | Ultra, $79/month (52,000 requests) |
Local compositing is cheapest when you already store the transparent master. Calling the endpoints directly is simpler when you do not want to maintain image-processing code. For store-wide workflows, see the e-commerce use case.
A simple asset strategy
- Keep the original upload unchanged.
- Create one transparent PNG as the canonical cutout.
- Generate white, colored, or gradient derivatives per channel.
- Store the processing options with each derivative.
This approach keeps your catalog consistent and makes future redesigns inexpensive. For the complete automation flow, read our e-commerce product image automation guide.
Frequently asked questions
Is a transparent PNG accepted as a marketplace main image?
Often not. Many marketplaces require a pure white background for the main image, and some convert uploaded transparency in unpredictable ways. Flatten onto white yourself and check each marketplace's current image rules.
Why did my transparent PNG turn black when I converted it to JPEG?
JPEG has no alpha channel. The converter discarded transparency and exposed the color data stored in transparent pixels. Composite onto white first, then save as JPEG.
Should I use PNG or WebP for transparent images on my store?
Keep PNG as your master file. For delivery, WebP supports transparency at smaller file sizes and is a good choice if your platform serves it. Generate the WebP from the PNG master.
Can I get a white background directly without storing a transparent file?
Yes. Send the original to /v2/rembg/color/ with bgcolor set to (255, 255, 255, 255). You can also try it on a sample image in the playground.