Skip to content
Pruna AI logo

P-Image Try-On

Image-to-Image • Pruna AI

View as MarkdownAgent setup
  • Third-party

Pruna's P-Image Try-On virtually fits one or more garments onto a person's photo. Provide a photo of a person plus garment reference images and the model realistically dresses the person in the provided garments.

Model Info
More informationlink ↗
Pricing
  • Per image$0.015
  • Per input image$0.008

Usage

const response = await env.AI.run(
  'pruna/p-image-try-on',
  {
    person_image:
      'https://huggingface.co/spaces/yisol/IDM-VTON/resolve/main/example/human/00121_00.jpg',
    garment_images: [
      'https://huggingface.co/spaces/yisol/IDM-VTON/resolve/main/example/cloth/04469_00.jpg',
    ],
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "pruna/p-image-try-on",
  "input": {
    "person_image": "https://huggingface.co/spaces/yisol/IDM-VTON/resolve/main/example/human/00121_00.jpg",
    "garment_images": [
      "https://huggingface.co/spaces/yisol/IDM-VTON/resolve/main/example/cloth/04469_00.jpg"
    ]
  }
}'
Single Garment
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/pruna/p-image-try-on/single-garment.jpg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

Examples

Turbo PNG — Faster generation with turbo optimizations, returning a PNG.
const response = await env.AI.run(
  'pruna/p-image-try-on',
  {
    person_image:
      'https://huggingface.co/spaces/yisol/IDM-VTON/resolve/main/example/human/00121_00.jpg',
    garment_images: [
      'https://huggingface.co/spaces/yisol/IDM-VTON/resolve/main/example/cloth/09163_00.jpg',
    ],
    turbo: true,
    output_format: 'png',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "pruna/p-image-try-on",
  "input": {
    "person_image": "https://huggingface.co/spaces/yisol/IDM-VTON/resolve/main/example/human/00121_00.jpg",
    "garment_images": [
      "https://huggingface.co/spaces/yisol/IDM-VTON/resolve/main/example/cloth/09163_00.jpg"
    ],
    "turbo": true,
    "output_format": "png"
  }
}'
Turbo PNG
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/pruna/p-image-try-on/turbo-png.png"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

Parameters

person_image
stringrequiredImage of the person to dress. A publicly reachable HTTP(S) URL or a base64 data URI (data:image/...;base64,...).
prompt
stringrequireddefault: Experimental guidance for non-flatlay garment images, e.g. which garment from which image to use.
seed
integerminimum: -9007199254740991maximum: 9007199254740991Random seed. Leave unset for a random seed.
turbo
booleanrequireddefault: falseRun faster with additional optimizations. Not recommended for more than 4 garments.
output_format
stringrequireddefault: jpgenum: webp, jpg, pngFormat of the saved output image.
output_quality
integerrequireddefault: 95minimum: 0maximum: 100Quality for jpg/webp outputs, from 0 to 100.
reference_pose
stringOptional reference pose image (HTTP(S) URL or data URI). When provided, the person is reposed to match this reference before virtual try-on.
preserve_input_size
booleanrequireddefault: trueReturn the output at the original input resolution.
image
stringformat: uriPresigned URL for the generated try-on image.

API Schemas (Raw)

Input
Output

Was this helpful?