IDM VTON

Best-in-class clothing virtual try on in the wild

~10.38s
~$0.041
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/idm-vton"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "crop": false,
12    "seed": 42,
13    "steps": 30,
14    "category": "upper_body",
15    "force_dc": false,
16    "human_img": "https://segmind-sd-models.s3.amazonaws.com/display_images/idm-ip.png",
17    "garm_img": "https://segmind-sd-models.s3.amazonaws.com/display_images/idm-viton-dress.png",
18    "mask_only": false,
19    "garment_des": "Green colour semi Formal Blazer"
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25    result = response.json()
26    print(json.dumps(result, indent=2))
27else:
28    print(f"Error: {response.status_code}")
29    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/idm-vton

Parameters

garm_imgrequired
string (uri)

Garment, should match the category, can be a product image or even a photo of someone

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/idm-viton-dress.png"
human_imgrequired
string (uri)

Model, if this is not 3:4 check crop

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/idm-ip.png"
categoryoptional
string

An enumeration.

Default: "upper_body"
Allowed values :
"upper_body""lower_body""dresses"
cropoptional
boolean

Use cropping? (check this if your image is not 3:4)

Default: false
force_dcoptional
boolean

Use the DressCode version of IDM-VTON (this is default false, except if category=dresses)

Default: false
garment_desoptional
string

Description of garment e.g. Short Sleeve Round Neck T-shirt

Default: "Green colour semi Formal Blazer"
mask_imgoptional
string (uri)

Mask image, optional (but faster)

Default: null
mask_onlyoptional
boolean

Return only the mask

Default: false
seedoptional
integer
Default: 42
stepsoptional
integer
Default: 30Range: 1 - 40

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out