Why Shadows Matter for E-commerce
Product images on white backgrounds look flat. Shadows create depth, making products appear real and premium. Studies show:
- Products with realistic shadows have 18โ30% higher click-through rates
- Shadow depth signals quality โ used by Apple, Nike, and every major brand
- Consistent shadow style across catalog creates professional brand impression
Quickstart โ curl
# Add soft studio shadow to your product
curl -X POST https://api.pixelapi.dev/v1/image/add-shadow \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/product.png",
"shadow_type": "soft",
"shadow_opacity": 0.5,
"shadow_blur": 20,
"shadow_offset_x": 8,
"shadow_offset_y": 12
}'
# Response:
# {"generation_id": "abc123", "status": "queued", "credits_used": 0.02}
# Poll for result:
curl https://api.pixelapi.dev/v1/generation/abc123 \
-H "Authorization: Bearer YOUR_API_KEY"
Python โ Full Example
import requests, time
API_KEY = "YOUR_API_KEY"
BASE = "https://api.pixelapi.dev"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
def add_shadow(image_url: str, shadow_type: str = "soft",
opacity: float = 0.5, blur: int = 20) -> str:
"""Add shadow and return output URL."""
# Queue the job
r = requests.post(
f"{BASE}/v1/image/add-shadow",
headers=HEADERS,
json={
"image_url": image_url,
"shadow_type": shadow_type,
"shadow_opacity": opacity,
"shadow_blur": blur,
"shadow_offset_x": 8,
"shadow_offset_y": 12,
}
)
r.raise_for_status()
gen_id = r.json()["generation_id"]
# Wait for completion (typically 1-3 seconds)
for _ in range(60):
status = requests.get(
f"{BASE}/v1/generation/{gen_id}", headers=HEADERS
).json()
if status["status"] == "completed":
return status["output_url"]
elif status["status"] == "failed":
raise Exception(f"Shadow generation failed: {status.get('error')}")
time.sleep(1)
raise TimeoutError("Shadow generation timed out")
# Example: full product photography pipeline
product_url = "https://example.com/sneaker_nobg.png" # transparent PNG
# Try different shadow styles
for style in ["soft", "floating", "hard"]:
result_url = add_shadow(product_url, shadow_type=style, opacity=0.45)
print(f" {style}: {result_url}")
# Cost: $0.010 per call = $0.030 for all 3 variants
Complete E-commerce Workflow (BG Removal + Shadow)
import requests, time
from pathlib import Path
API_KEY = "YOUR_API_KEY"
BASE = "https://api.pixelapi.dev"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
def product_photo_pipeline(image_path: str, shadow="soft") -> str:
"""
Complete pipeline: raw product photo โ professional e-commerce image
Step 1: Remove background ($0.005)
Step 2: Add shadow ($0.010)
Total: $0.015 per product
"""
# Step 1: Remove background
with open(image_path, "rb") as f:
r = requests.post(
f"{BASE}/v1/image/remove-background",
headers=HEADERS,
files={"image": f},
data={"output_format": "png"}
)
gen1 = r.json()["generation_id"]
# Wait for BG removal
while True:
s = requests.get(f"{BASE}/v1/generation/{gen1}", headers=HEADERS).json()
if s["status"] == "completed": break
if s["status"] == "failed": raise Exception(f"BG removal failed")
time.sleep(1)
nobg_url = s["output_url"]
# Step 2: Add shadow
r2 = requests.post(
f"{BASE}/v1/image/add-shadow",
headers=HEADERS,
json={"image_url": nobg_url, "shadow_type": shadow,
"shadow_opacity": 0.45, "shadow_blur": 18}
)
gen2 = r2.json()["generation_id"]
while True:
s2 = requests.get(f"{BASE}/v1/generation/{gen2}", headers=HEADERS).json()
if s2["status"] == "completed": break
if s2["status"] == "failed": raise Exception(f"Shadow failed")
time.sleep(1)
return s2["output_url"]
# Process catalog
images = ["shoe1.jpg", "bag2.jpg", "watch3.jpg"]
for img in images:
url = product_photo_pipeline(img)
print(f"โ
{img} โ {url}")
# Total per image: $0.015
print(f"Total cost: ${len(images) * 0.015:.2f}")
Parameters Reference
{
"image_url": "https://...", // URL to PNG (transparent preferred)
"shadow_type": "soft", // soft | hard | natural | floating | none
"shadow_opacity": 0.5, // 0.0 (invisible) to 1.0 (full black)
"shadow_blur": 20, // 0 (sharp) to 80 (very soft)
"shadow_offset_x": 8, // -100 to 100 pixels (left/right)
"shadow_offset_y": 12 // -100 to 100 pixels (up/down)
}
โ Photoroom Shadow API
- $0.05โ0.10 per image
- Requires Photoroom subscription
- Limited API access
- No custom shadow placement
โ PixelAPI Shadow
- $0.010 per image โ 5x cheaper
- Full REST API, no subscription needed
- 4 shadow styles + full parameter control
- Pairs with BG removal in one pipeline
๐ก Best practice: Always run Background Removal first (to get a clean transparent PNG), then add the shadow. This gives the most realistic result.
Add Shadows to Your Product Catalog
Start free โ 100 credits included. No credit card required.
Try Free โ Batch Tutorial โ