1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const axios = require('axios');
const fs = require('fs');
const path = require('path');
async function toB64(imgPath) {
const data = fs.readFileSync(path.resolve(imgPath));
return Buffer.from(data).toString('base64');
}
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/segfit-v1.2";
const data = {
"outfit_image": "toB64('https://segmind-resources.s3.amazonaws.com/others/c63e9544-10da-45cd-81f9-725fb98ca0c0-090a11c5-4e9a-42f2-8cf7-d74de7e1ebcf.png')",
"model_image": "toB64('https://segmind-resources.s3.amazonaws.com/others/be81a5a2-a928-47d2-927e-cdc4cf25cb96-model_1.png')",
"model_type": "Balanced",
"cn_strength": 0.35,
"cn_end": 0.35,
"image_format": "png",
"image_quality": 90,
"seed": 42,
"base64": false
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();
Image of the outfit to be fitted. Example: a dress or suit.
Image of the model for try-on. Example: front-facing, well-lit image.
Choose the generation model type. Use 'Speed' for fast results, 'Quality' for high detail.
Allowed values:
Strength of ControlNet's influence. Maintains the shape of the model.
min : 0,
max : 1
Endpoint for ControlNet's effect. Controls the model body shape, Higher the value, higher the control
min : 0,
max : 1
Output image format. 'PNG' is versatile, 'JPEG' compresses well.
Allowed values:
Determine image quality (1-100). Use 100 for best detail, lower for smaller file size.
min : 1,
max : 100
Ensures reproducibility. Set to -1 for random variation.
min : -1,
max : 999999
Return image as base64 string instead of URL.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Segmind's SegFit v1.2 is a state-of-the-art model in the SegFIT suite, enabling the creation of lifelike virtual try-on experiences for the fashion industry. With its ability to generate photorealistic try-on images using both product and model photos, SegFit v1.2 eliminates the need for physical photoshoots, enhancing engagement and conversions for e-commerce, marketing, and content creation.
SegFit excels in mapping garments onto virtual models, offering ultra-realistic visualizations that capture the garment's boundaries, shape, and drape with precision. This feature ensures a believable and immersive try-on experience.
The model's AI-driven automatic masking differentiates between clothing and the background, accurately identifying garment edges. This capability reduces manual input preparation, streamlining the try-on process.
With support for various input types such as flat lay photos for garments and required model images, SegFit v1.2 provides configurable output options such as aspect ratios and quality modes, catering to diverse content needs.
SegFit identifies multiple garments within a single image and simulates texture and movement, reflecting realistic draping on model images. Customizable virtual models ensure output is tailored to target demographics, enhancing inclusivity.
Offered as a serverless API, SegFit enables easy integration into digital workflows, ideal for e-commerce and creative pipelines.
To maximize the potential of SegFit, utilize high-quality product and model photography and leverage the API for bulk processing. Customize virtual models for broader market appeal and iterate using segmented workflow features for precision. Combining SegFit outputs with other creative models can produce comprehensive marketing visuals, streamlining the fashion retail experience.