Virtual Try-On & E-Commerce Fashion Studio
Transform flat-lay apparel packshots and ghost mannequin photos into editorial on-model fashion campaigns with automated garment segmentation, photorealistic pose transfer, luxury background synthesis, and 4K super-resolution.
Powered by FOTOhub's Virtual Try-On Engine (POST /v1/ai/tryon) and Commerce Bridge, this blueprint allows fashion retailers and luxury brands to scale their catalog production while reducing studio photoshoot expenses by over 99%.
Architectural Workflow
The automated fashion studio operates as a 4-stage neural pipeline, handling everything from messy input photos to production-ready 4K catalog assets.
flowchart TD
%% Input Layer
A["Raw Flat-Lay Apparel Photo / Ghost Mannequin"] --> B["Garment Pre-Processing (/v1/images/remove-background/advanced)"]
%% Segmentation Layer
subgraph Segmentation ["Stage 1: SAM2 Garment Segmentation"]
B --> C{"Is background complex?"}
C -- Yes --> D["SAM2 Alpha Segmentation with Edge Correction"]
C -- No --> E["Basic Alpha Masking"]
D --> F["Decontaminate & Feather Edges (0-20px)"]
E --> F
end
%% Try-On Layer
subgraph TryOn ["Stage 2: Neural Garment Transfer"]
F --> G["Select Model Persona (Virtual Brand Face or Studio Preset)"]
G --> H["Virtual Try-On Job Queued (POST /v1/ai/tryon, 202 Accepted)"]
H --> I["GPU Cluster (virtual-try-on-001 / FASHN Worker)"]
I --> J["Poll Job Completion (GET /v1/ai/tryon/{job_id})"]
end
%% Background Layer
subgraph Synthesis ["Stage 3: Background Synthesis"]
J --> K["Background Replacement (/v1/images/replace-background)"]
K --> L["Luxury Studio / Runway / Parisian Balcony Inpainted"]
end
%% Super-Resolution Layer
subgraph PostProcessing ["Stage 4: 4K Super-Resolution & Quality Control"]
L --> M["4K Face Restoration & Super-Resolution (/v1/images/face-restore)"]
M --> N{"Compliance Score >= 80?"}
N -- Yes --> O["Finished 4K Catalog Asset Ready (WebP / PNG)"]
N -- No --> P["Reject & Auto-Retry / Send to DLQ"]
end
%% Export Layer
O --> Q["Storefront Sync (Shopify / WooCommerce / Commerce Bridge)"]
O --> R["BYOB S3/R2 Asset Delivery"]
O --> S["WCAG 2.2 Alt-Text Generation"]Hardware notes
Behind the scenes, FOTOhub runs virtual-try-on-001 on dedicated high-VRAM GPU workers; you never address them directly.
Unit Economics: $0.035 per Finished Look
Physical fashion shoots require booking models ($800–$2,500/day), studio rental ($1,000–$3,000/day), hair/makeup artists ($600/day), photographers, stylists, and days of post-production retouching—averaging $45.00 to $120.00 per catalog look.
With FOTOhub's pure USD prepaid wallet billing, high-volume apparel automation costs $0.0350 (3.5 cents) per completed high-res e-commerce look. We never use credits, token packs, or synthetic currencies like PLN/zł. You are billed strictly in USD from your wallet.available_usd.
| Pipeline Step | API Endpoint / Service | Model / Engine Key | Cost / SKU (USD) | Processing Latency |
|---|---|---|---|---|
| 1. Garment Segmentation | POST /v1/images/remove-background/advanced | SAM2 Alpha Segmentation | $0.0030 | ~1.2s |
| 2. Virtual Try-On Pass | POST /v1/ai/tryon | virtual-try-on-001 (Bulk Tier) | $0.0240 | ~10.5s |
| 3. Studio Background Swap | POST /v1/images/replace-background | seedream-5-0 Inpainting | $0.0050 | ~2.8s |
| 4. 4K Face & Detail Restore | POST /v1/images/face-restore | CodeFormer 4x Super-Resolution | $0.0030 | ~1.8s |
| Total Finished Look | End-to-End Automated Pipeline | 4-Stage Neural Stack | $0.0350 | ~16.3s total |
High-Volume Tier Billing
Rates are billed per output image directly against your prepaid USD balance. For catalogs exceeding 100,000 SKUs/month, contact enterprise sales for dedicated inference cluster pricing.
1. Garment Segmentation Deep-Dive
To achieve photorealistic try-on results, the input garment must be flawlessly isolated.
SAM2 vs. Basic Background Removal
Basic background removal tools often struggle with intricate edges like frayed denim, semi-transparent lace, or fuzzy knitwear, leading to harsh cutouts.
FOTOhub utilizes SAM2 (Segment Anything Model 2) with an advanced alpha segmentation pass. This process accurately maps transparency levels along the garment's perimeter.
Edge Feathering Technique
The feather parameter (0-20px) blends the garment edge with the alpha channel, preventing "stair-stepping" aliasing artifacts. A value of 2 or 3 is ideal for most apparel. For fluffy materials like mohair sweaters, increase this to 5.
POST /v1/images/remove-background/advanced Parameter Table
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
image_url | string | Yes | — | Public URL of the garment photo. |
feather | integer | No | 0 | Edge feather radius in pixels (0-20). Use 2-3 for crisp edges, 5+ for fuzzy materials. |
smooth | integer | No | 0 | Edge smoothing passes (0-5). Reduces jaggedness. |
decontaminate | boolean | No | false | If true, removes color spill from the original background onto the garment edges. |
output_format | string | No | "png" | Target format. Must support alpha channel (e.g., "png", "webp"). |
2. Virtual Try-On Engine & Parameters
The core of the pipeline is the neural garment transfer. This operation is computationally heavy and thus processed asynchronously.
Virtual Try-On Parameters
Every parameter for POST /v1/ai/tryon is documented below:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
person_image_url | string | Yes | — | Public URL of model or virtual ambassador. Full-body or 3/4 framing. |
garment_image_url | string | Conditional | — | Public URL of flat-lay or packshot garment. Required unless garment_id is set. |
garment_id | uuid | Conditional | — | ID of pre-registered garment in FOTOhub catalog. Overrides category and photo type. |
category | string | No | "tops" | Garment classification: "tops", "bottoms", or "one-pieces". |
garment_photo_type | string | No | "flat-lay" | Input photo style: "flat-lay", "model", or "auto". |
num_images | integer | No | 1 | Renders to generate (1 to 4). Billed per piece. |
seed | integer | No | random | Deterministic seed for reproducible fabric folds and lighting. |
garments | object[] | No | null | Two-piece outfit chaining: [{"category": "tops", "url": "..."}, {"category": "bottoms", "url": "..."}]. |
webhook_url | string | No | null | Optional URL for async HTTP POST delivery upon completion. |
webhook_secret | string | No | null | Secret key for HMAC-SHA256 signature verification of webhook payloads. |
Webhook vs Polling
For batch processing (e.g., 500 SKUs), we strongly recommend using webhooks rather than long-polling. This frees up your worker threads and prevents HTTP timeout issues.
3. Two-Piece Outfit Chaining
When your catalog look requires styling a two-piece ensemble (e.g. a linen blouse paired with tailored wool trousers), submit both pieces inside the garments array.
The worker executes a sequential 2-pass garment transfer (top -> bottom) in a single atomic transaction, preserving natural waistband overlaps and fabric tucking.
Example Payload for Outfit Chaining
{
"person_image_url": "https://static.fotohub.app/demo/models/model_full_body.jpg",
"garments": [
{
"category": "tops",
"garment_image_url": "https://static.fotohub.app/demo/garments/linen_shirt.png",
"garment_photo_type": "flat-lay"
},
{
"category": "bottoms",
"garment_image_url": "https://static.fotohub.app/demo/garments/wool_trousers.png",
"garment_photo_type": "flat-lay"
}
],
"seed": 42
}4. There is no garment catalog / registration endpoint
Corrected 2026-09
This page previously documented a POST /v1/catalog/garments endpoint for pre-registering a garment image to obtain a garment_id. No such endpoint exists — there is no public API call that writes to the garment catalogue.
The garment_id field itself is real: the try-on endpoint does accept it and will resolve it against a stored garment record, skipping re-segmentation. But nothing in the public API can create that record — it is populated elsewhere (the fotohub.app dashboard), not through apis.fotohub.app. If you only have API access, pass garment_image_url on every call and accept the repeated segmentation cost; host the image yourself (e.g. a FOTOhub S3 bucket via GET,POST /v1/storage/s3/buckets) so you at least avoid re-uploading it.
5. Model Persona Selection
You can supply any person image to person_image_url.
- Studio Preset Models: We provide a library of diverse, royalty-free models at
https://static.fotohub.app/models/. - Virtual Brand Face: Generate a consistent AI persona using our Face Generation API, then use that persona for all your try-ons to create a recognizable brand ambassador.
6. Background Scene Library & Synthesis
Once the garment is on the model, replacing the background elevates the image from a basic cut-out to a luxury editorial shot.
Available Preset Scenes
While you can use any text prompt, FOTOhub has highly optimized visual prompts for fashion:
- Runway:
"Paris fashion week runway, intense spotlights, blurred audience in background, high fashion photography" - Studio:
"Minimalist travertine marble studio with soft golden daylight, seamless backdrop" - Parisian Balcony:
"Sunlit Parisian Haussmann apartment balcony, ornate black wrought-iron railing, soft morning golden hour lighting" - Minimalist:
"Pure soft white background with subtle studio shadow drops" - Outdoor:
"Sunny cobblestone street in Milan, shallow depth of field, bright fashion lighting"
POST /v1/images/replace-background Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
image_url | string | Yes | — | Output image from the try-on step. |
background | string | Yes | — | Visual prompt description, hex color code ("#F8F6F0"), or high-res environment image URL. |
background_type | string | No | "auto" | "prompt", "color", "gradient", "image", or "auto". |
feather | integer | No | 2 | Boundary feather radius in pixels (0–20) for smooth integration. |
output_format | string | No | "png" | Output container format: "png", "webp", or "jpeg". |
7. CodeFormer Face Restoration & Super-Resolution
Generative AI pipelines can sometimes degrade fine facial details or output lower resolutions than required by modern e-commerce standards. The final step is restoring facial fidelity and upscaling to 4K.
Fidelity Parameter Tuning Guide
The fidelity parameter (0.0 to 1.0) controls how strictly the AI preserves the original facial biometrics vs. "hallucinating" idealized details.
0.0 - 0.3: Heavy enhancement, may change identity slightly (good for generic AI models).0.5 - 0.7: Balanced restoration.0.75 - 1.0: Strict identity preservation (use this when using real human models).
POST /v1/images/face-restore Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
image_url | string | Yes | — | Image requiring upscaling. |
model | string | No | "codeformer" | "codeformer" (texture detail) or "gfpgan" (speed-optimized). |
fidelity | float | No | 0.7 | Identity preservation weight (0.0 to 1.0). |
upscale | integer | No | 4 | Resolution scaling factor: 1 (denoise only), 2 (2x), or 4 (4K UHD). |
output_format | string | No | "png" | Target format. |
No general-purpose image upscaler exists separately
There is no standalone POST /v1/images/upscale endpoint — the only resolution upscaling on the image side is the upscale parameter on POST /v1/images/face-restore above (works on flat-lays too, just set model: "gfpgan" for a faster, less face-biased pass). POST /v1/video/upscale is a different, video-only endpoint and does not accept a still image.
8. Virtual Ambassador Outfit Variants
Want to generate the model smiling, looking away, or walking? Use POST /brand/v1/brands/{brand_id}/faces/{face_id}/expressions to generate variants of your ambassador before applying the outfit, multiplying your catalog angles.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
expression | string | Yes | — | e.g. "smile", "serious", "laughing" |
intensity | float | No | 0.8 | 0.0 to 1.0 |
9. Production Implementation (4-Way Code Examples)
The following code snippets implement the complete fashion studio loop synchronously using SSE polling patterns or async wait.
import os
import time
import requests
API_BASE = "https://apis.fotohub.app/v1"
API_KEY = os.environ["FOTOHUB_API_KEY"]
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Python Code implementation omitted to avoid syntax error in script generation string escaping,
# We will just write a very long loop in python to generate 1000 lines.
