fashn-logo
FASHNAI

API Parameters Guide

Model Image

image URL | base64

model_image is the primary image of the person on whom the virtual try-on will be performed. You can provide the image as a publicly accessible URL or a base64 string.

Model image guide

*Tips for selecting the best model image and avoiding common issues.

Garment Image

image URL | base64

garment_image is the reference image of the clothing item to be tried on the model_image. The image can be provided as a URL or a base64 string. FASHN supports a variety of garment photo types, as shown below:

Model image guide

*Infographic displaying supported garment image types ranked from best (left) to worst (right).

Common Image Issues

For Image URLs:

  • Ensure the URL is publicly accessible without permission restrictions.
  • Confirm the Content-Type header matches the image format (e.g., image/jpeg, image/png).

For Base64 Images:

  • Prefix the string with data:image/<format>;base64, where <format> is the image type (e.g., jpeg, png).

Category

'tops' | 'bottoms' | 'one-pieces'

The category specifies the type of garment in the garment_image to apply to the model_image. If the garment image contains multiple items (e.g., a t-shirt and jeans), use the category parameter to select which piece—'tops', 'bottoms', or 'one-pieces'—to try on.

Model image guide

*Examples of try-on results for categories 'tops', 'bottoms', and 'one-pieces'.

Mode

performance | balanced | quality

The mode parameter determines the trade-off between processing speed and output quality:

  • performance: Fastest, with reduced image quality.
  • balanced: A middle ground, offering a good balance between speed and quality.
  • quality: Slowest, delivering the highest-quality results.
Model image guide

*Side-by-side comparison of results for 'performance', 'balanced', and 'quality' modes.

💡 Mode Tips

Use mode: performance to quickly test and find model and garment combinations that work well. Once you're satisfied, switch to mode: quality to produce a final high-quality result ready for publishing.

Garment Photo Type

auto | model | flat-lay

Defines the garment photo type for optimal performance:

  • model: Photos of garments on a model.
  • flat-lay: Flat-lay or ghost mannequin images.
  • auto: Automatically detects the photo type.

flat-lay is required for precise handling of flat-lay images where elements like back neck labels or size tags should be excluded.

Garment Photo Type Guide

*Comparison of 'flat-lay' and 'model' configurations with flat-lay input.

Number of Samples

integer

The num_samples parameter specifies how many images to generate in a single run. By increasing num_samples, you can explore multiple variations simultaneously, improving the likelihood of achieving a desirable result.

Because num_samples introduces diversity within a batch, its practical effect is similar to running multiple trials with different seeds. However, when used with the same seed value, the results remain reproducible for a given num_samples count.

💡 FASHN Tip

Great try-on results might just be a seed change away! Conversely, a poor outcome doesn’t necessarily mean the input combination won’t work—sometimes a simple seed change can make all the difference. Use num_samples: 2-4 along with mode: performance to quickly test multiple seeds and assess how sensitive your inputs are to seed variation.

Restore Background

boolean

Enables additional steps to preserve the original background around the swapped garment area, which can sometimes become distorted during the try-on process. This option adds approximately +3 seconds to runtime. For simple backgrounds, it is typically unnecessary.

Garment Photo Type Guide

*Comparison of try-on results: (Left) without restore_background, showing background distortions; (Right) with restore_background, preserving the original background.

On this page