Back to Skills

GPT Image 2 Virtual Try-On

gpt-image-2-virtual-tryon

Handle ecommerce and fashion-design GPT Image 2 image generation, virtual try-on, clothing replacement, garment reference transfer, outfit variants, and model/catalog visuals from prompts or reference images.

SKILL.md

GPT Image 2 Virtual Try-On

Use this skill when the user wants GPT Image 2 to create virtual try-on, clothing replacement, garment styling, or fashion-design visualization images for ecommerce product pages, catalog looks, campaign concepts, design reviews, or outfit variants.

Use the general gpt-image-2 skill instead when the request is generic image generation/editing and does not involve fashion, garments, outfit styling, catalog model imagery, or apparel ecommerce.

Implementation Actions

Use only these concrete connector actions. Do not search for image models or connector capabilities at runtime.

  • Text-to-image async submit: fusion-api.openai_image_async_submit
  • Text-to-image async result: fusion-api.openai_image_async_result
  • Image edit async submit: fusion-api.openai_image_edit_async_submit
  • Image edit async result: fusion-api.openai_image_edit_async_result

No Fusion API synchronous text-to-image action is selected for this skill. Do not call fusion-api.openai_image_generate; use async submission and polling for text-to-image generations.

Fusion API is the selected built-in provider path. Do not ask the user for an OpenAI API key during normal execution unless the connector returns an auth or billing failure that explicitly requires user action.

Execution Map

  • No image inputs: run fusion-api.openai_image_async_submit, then poll fusion-api.openai_image_async_result.
  • Person/model, garment, pose, style, mask, file_id, local image path, or public image URL present: run fusion-api.openai_image_edit_async_submit, then poll fusion-api.openai_image_edit_async_result.
  • Local image paths: upload first with oo file upload "<filePath>" --json, then pass the returned downloadUrl as images[].image_url or mask.image_url.
  • Do not silently turn an image-based try-on request into text-to-image. If an image reference is required but inaccessible, stop and ask for an accessible image or file_id.

Mode Selection

Choose text-to-image when the user provides no image inputs and asks for a new fashion image, outfit concept, lookbook frame, product card, or model/catalog visual from a prompt.

Choose image editing when the user provides a person/model image, garment image, outfit reference, pose reference, style reference, mask, file_id, local image path, attached image, or public image URL. This includes changing clothes on a person, transferring a garment from a product photo to a model, preserving a model while replacing clothing, or creating variants from reference images.

Ask Policy

Ask at most one concise follow-up, and only when execution would be ambiguous or impossible.

When asking, present a short choice prompt with a recommended option. Use a free-form input option only when concrete choices cannot cover the decision.

Ask when:

  • The user wants clothing placed on a specific person/model but did not provide that person/model image or file_id.
  • The user wants a specific garment transferred but did not provide the garment reference or enough text to identify it.
  • The provided image path, URL, or file_id is inaccessible.
  • The user provides several images but does not make the source/garment/pose roles inferable from wording or filenames.

Do not ask when:

  • Only cosmetic settings are missing. Infer size, quality, format, background, and variant count from the defaults below.
  • The user provides only a garment reference and asks for a generic catalog model, product card, or lookbook image. Use image editing with the garment as the reference and create a suitable model/context.
  • The user asks for exploratory outfit variants. Default to n: 4.

Inputs To Capture

Useful optional inputs:

  • Target use case: product detail page, marketplace thumbnail, lookbook, campaign image, fit visualization, design review, or variant exploration.
  • Garment role: top, bottom, dress, outerwear, footwear, accessory, full outfit, or design sketch to render.
  • Constraints to preserve: model identity, pose, body proportions, hairstyle, garment color, fabric texture, print, logo placement, seams, trims, silhouette, and layering.
  • Desired changes: background, camera angle, crop, lighting, pose, styling, seasonal mood, model diversity, or number of variants.
  • Output settings: size, quality, n, output_format, background, response_format, and optional output_compression.

Local Image Handling

For local image inputs, upload the file with oo file upload "<filePath>" --json first. Parse the returned JSON object’s downloadUrl field and pass that signed download URL as images[].image_url or mask.image_url. Do not pass raw local file paths to Fusion API connector actions.

Example:

oo file upload "/path/to/model.png" --json

Expected JSON shape:

{
  "downloadUrl": "https://...",
  "expiresAt": "2026-05-14T00:00:00.000Z",
  "fileName": "model.png",
  "fileSize": 12345,
  "id": "019...",
  "status": "active",
  "uploadedAt": "2026-05-07T00:00:00.000Z"
}

Each image reference must contain exactly one of:

  • image_url: a public image URL
  • file_id: an OpenAI file ID

For edit inputs, preserve the user’s intended order. Default order:

  1. Main person/model image.
  2. Garment or outfit reference image.
  3. Optional pose, styling, background, or brand reference images.

If the user provides a mask, pass it as mask; do not also include it as a normal reference image unless it is separately useful as visual context.

When a remote result URL must be saved locally, use oo file download "<url>" "<outDir>" --name "<fileNameWithoutExtension>" --ext "<extension>" when you need a deterministic local filename. oo file download prints Saved to: <path> on stdout and does not support --json; read the saved path from that line. For b64_json or data:image/...;base64,... results, decode the base64 content directly into a local image file instead of downloading. After saving, preview or deliver the saved artifact to the user.

Prompt Rules

Write concise production prompts in ecommerce or fashion-design language. Keep fixed constraints explicit and separate them from creative changes.

For image-based try-on, say exactly which garment or outfit should be applied and what must remain unchanged. Ask GPT Image 2 to preserve the source person’s identity, face, pose, body proportions, skin tone, hairstyle, visible accessories, camera angle, lighting, and background unless the user asks to change them. Preserve the reference garment’s color, fabric, texture, print, construction, logo placement, trims, silhouette, and layering. Request realistic fit, natural drape, believable shadows, clean boundaries around sleeves, collars, waistbands, hems, hair, hands, and no extra text or watermark.

For fashion-design exploration, describe the garment intent, materials, trim, construction details, target customer, styling direction, and the type of output needed, such as full-body model render, flat lay, campaign concept, or variant grid. Separate fixed constraints from experimental variations.

For text-to-image catalog visuals, include model framing, garment details, camera/crop, background, lighting, and ecommerce cleanliness. Do not claim identity or exact garment preservation when no reference image exists.

Payload Rules

Shared defaults:

  • Use "gpt-image-2" for model.
  • Use "b64_json" for response_format so the image can be saved locally and previewed reliably. Use "url" only when the user explicitly needs a remote URL, and still handle returned data:image/...;base64,... values as inline image data rather than as downloadable HTTP URLs.
  • Use "png" for final ecommerce assets, transparent outputs, textile detail, or design review fidelity. Use "webp" only for lightweight ecommerce previews or when requested.
  • Use "high" quality for final try-on, identity preservation, garment fidelity, product detail, and deliverable assets. Use "auto" for quick drafts.
  • Use 1 image for a single final request and 4 images for variant exploration unless the user specifies a count.

Size defaults:

  • Full-body model or try-on: "1024x1536"
  • Marketplace thumbnail or product card: "1024x1024"
  • Lookbook, campaign concept, or horizontal board: "1536x1024"
  • Smaller draft: "512x512" or "256x256" only when requested or clearly useful

Do not include legacy FAL fields such as imageURLs, maskURL, imageSize, numImages, or outputFormat in Fusion API GPT Image 2 actions. Use images, mask, size, n, and output_format.

For long prompts, nested image arrays, masks, or quote/newline-heavy values, write the payload to a JSON file and run with --data @payload.json instead of inline shell JSON.

Text-To-Image Workflow

Use fusion-api.openai_image_async_submit and fusion-api.openai_image_async_result for text-to-image requests.

Example payload:

{
  "prompt": "Create a realistic full-body ecommerce fashion image. Show the model wearing a structured ivory linen blazer over a black fitted top and straight-leg denim. Preserve natural body proportions, realistic fabric texture, clean sleeve and collar edges, believable shadows, sharp product detail, no extra text, and no watermark.",
  "model": "gpt-image-2",
  "size": "1024x1536",
  "quality": "high",
  "n": 1,
  "output_format": "png",
  "response_format": "b64_json"
}

Submit:

oo connector run "fusion-api" \
  --action "openai_image_async_submit" \
  --data '{"model":"gpt-image-2","prompt":"Create a realistic full-body ecommerce fashion image. Show the model wearing a structured ivory linen blazer over a black fitted top and straight-leg denim. Preserve natural body proportions, realistic fabric texture, clean sleeve and collar edges, believable shadows, sharp product detail, no extra text, and no watermark.","size":"1024x1536","quality":"high","n":1,"output_format":"png","response_format":"b64_json"}' \
  --json

The submit action returns sessionId. Poll with:

oo connector run "fusion-api" \
  --action "openai_image_async_result" \
  --data '{"sessionID":"<sessionId>"}' \
  --json

If the result is processing, wait briefly and poll the same sessionId. Do not create a duplicate task unless the user asks to retry. If the result is not_found, report the returned error.

Image Editing Workflow

Required input:

  • prompt: 1 to 32000 characters
  • images: 1 to 16 image references

Always use input_fidelity: "high" when preserving a person, garment, product detail, pose, identity, or layout matters.

Submit:

oo connector run "fusion-api" \
  --action "openai_image_edit_async_submit" \
  --data '{"model":"gpt-image-2","prompt":"Replace the clothing on the source person with the reference garment. Preserve the same person, face, pose, body proportions, hairstyle, lighting, camera angle, and background. Preserve the garment color, fabric texture, print, logo placement, silhouette, trims, and construction. Make the fit realistic with natural drape, believable shadows, clean sleeve/collar/hem edges, no extra text, and no watermark.","images":[{"image_url":"https://example.com/person.png"},{"image_url":"https://example.com/garment.png"}],"size":"1024x1536","quality":"high","n":1,"output_format":"png","response_format":"b64_json","input_fidelity":"high"}' \
  --json

The submit action returns sessionId. Poll with:

oo connector run "fusion-api" \
  --action "openai_image_edit_async_result" \
  --data '{"sessionID":"<sessionId>"}' \
  --json

If the result is processing, wait briefly and poll the same sessionId. Do not create a duplicate task unless the user asks to retry. If the result is not_found, report the returned error.

Results

Read result fields in this order:

  • Async submit: extract sessionId; reuse it for polling and do not submit a duplicate job.
  • Async result: first check state. In oo connector run --json output, the action payload is wrapped in the top-level .data field.
    • completed: read image outputs from .data.data.data[].b64_json or .data.data.data[].url; read .data.data.data[].revised_prompt when useful.
    • processing: wait briefly and poll the same sessionID.
    • not_found: stop and report error.
  • If b64_json or data:image/...;base64,... is returned, decode it into a local image file and preview or deliver the saved artifact. Do not print full base64 strings or data URIs.

On success, make the image visible to the user. If the result contains a URL, include it as the primary deliverable and preview it when the agent environment supports image rendering. If the result is saved locally, show or attach the local image artifact rather than only reporting the path. A local path alone is not enough unless the environment cannot preview or attach files. Mention only material execution details such as model, size, quality, format, variant count, mask use, input_fidelity, or sessionId.

Failure Handling

  • processing: wait briefly and poll the same sessionId again.
  • not_found: stop and report the returned error; do not create a new job unless the user asks to retry.
  • Missing prompt, missing required image, inaccessible URL/path, unsupported option, schema rejection, auth, billing, or permission error: stop and report the smallest next fix.
  • If the connector rejects a field, remove or rename only the rejected field when the schema-supported equivalent is known. Do not switch models or connector actions silently.