Garment Virtual Try-On
Garment VTO overlays a product garment onto a person photo, generating a realistic composite image of the person wearing the item.
Garment Classes
Each request requires a garmentClass that tells the system what type of garment is being tried on. This determines how the garment is applied to the person image.
| Garment Class | Description | Examples |
|---|---|---|
UPPER_BODY | Tops and upper-body clothing | T-shirt, blouse, jacket, sweater |
LOWER_BODY | Bottoms and lower-body clothing | Jeans, shorts, skirt, trousers |
FOOTWEAR | Shoes and footwear | Sneakers, heels, boots, sandals |
FULL_BODY | Full outfits covering the entire body | Dress, jumpsuit, romper, suit |
Choose the garment class that best matches the product. Using the wrong class may produce unexpected results — for example, using UPPER_BODY for a pair of shoes.
Make Your First Request
Send a POST request to the /vto/garment endpoint with a person photo (sourceImage), a product garment photo (garmentImage), and the garmentClass.
curl -L -X POST 'https://api-company-xyz.evolvestorefront.com/image-engine/vto/garment' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...' \
-d '{
"sourceImage": "/9j/4AAQSkZJRgABAQAAAQABAAD...",
"garmentImage": "/9j/4AAQSkZJRgABAQEASABIAAD...",
"garmentClass": "UPPER_BODY"
}'
{
"success": true,
"data": {
"resultImage": "iVBORw0KGgoAAAANSUhEUgAA...",
"mimeType": "image/png",
"processingTime": 4.832
}
}
Understanding the Response
| Field | Description |
|---|---|
resultImage | Base64-encoded composite image of the person wearing the garment |
mimeType | The format of the result image (e.g., image/png) |
processingTime | Time in seconds taken to generate the image |
To display the result, decode the base64 string back to an image. For example, using the command line:
echo "<resultImage value>" | base64 -d > result.png
Error Handling
If the request fails, the response will include an error code and message:
{
"success": false,
"error": {
"message": "garmentClass must be one of: UPPER_BODY, LOWER_BODY, FOOTWEAR, FULL_BODY",
"code": "INVALID_GARMENT_CLASS"
}
}
| Error Code | HTTP Status | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Missing required fields or invalid request body |
INVALID_GARMENT_CLASS | 400 | garmentClass is not one of the valid enum values |
IMAGE_TOO_LARGE | 400 | Image exceeds 3,072 pixels on its longest side |
INVALID_IMAGE | 400 | Unable to decode the base64 image data |
IMAGE_GENERATION_ERROR | 500 | Generation failed — retry the request |