Virtual Try-On (Gemini)
Virtual try-on that doesn't warp the body — as long as you're okay paying Google per image
- image_1
- image_2
- image_3
- image_4
- image_5
- image_6
- image_7
- image_8
- image_9
- image_10
- image_11
- image_12
- images
Virtual Try-On (Gemini) is the "closed frontier" answer to one of ComfyUI's most stubborn local problems. It does not run a model on your GPU at all - it's an API wrapper that sends your person photos and garment shots up to Google's Gemini image model and drops the result back into your graph as a normal IMAGE tensor. If you've ever wrestled with IDM-VTON or CatVTON, you know the appeal instantly: local try-on models tend to reconstruct the person rather than swap the clothes, which is why a hoodie can arrive with a new slimmer owner attached. Gemini's multi-reference identity handling sidesteps most of that. The trade is that it costs real money per image, your data leaves the machine, and Google's safety filters decide what's allowed.
What it actually does
Up to twelve IMAGE inputs feed into one system prompt with {image_1} through {image_12} placeholders. The node interleaves your text and images into Gemini's "interleaved contents" format, calls generate_content, decodes the returned image bytes, and converts them back to a batched ComfyUI tensor on the images output. That output wires straight into a preview or a save node like any sampler's.
The bundled default prompt is the real work here - it enforces a strict contract: images 1–2 are the identity reference (face and body must be a "pixel-perfect likeness"), image 3 is the pose/scene template (duplicate it exactly but ignore the person in it), and 4–12 are the garments. Unconnected slots are silently skipped instead of erroring, so you can start with two identity photos and one shirt and grow from there.
The inputs that matter
model-gemini-3-pro-image-preview(the flagship, best identity fidelity) orgemini-3.1-flash-image-preview(the fast, cheap hybrid; the default).system_prompt- editable, with the{image_N}placeholders. This is the heart of the node; rewrite it to change how images are interpreted.aspect_ratioandimage_size- 10 aspect ratios (default3:4), and1K/2K/4Koutput. Note the default is 4K, and 4K costs more per call than 2K - for most product shots 2K is the smarter default.batch_size(1–4),seed(0 = random),temperature(0–2, default 1). Lower temperature to 0.2–0.5 for consistent production runs; the README's own tip.human_pose_override,camera_position_override,additional_prompt- appended onto the system prompt when you want to override what the reference images imply.
Everything else is the twelve image slots plus a project_name that's just a label.
Installing it
This is a small pack with no model downloads - the "heavy dependency" is Google's cloud, not your disk. google-genai>=1.0.0, python-dotenv, Pillow, numpy, and torch (which you already have).
cd ComfyUI/custom_nodes
git clone https://github.com/aarnoatchi/comfyui-vto
cd comfyui-vto
pip install -r requirements.txt
cp .env.example .env
Then put your key - from https://aistudio.google.com/app/apikey - in the .env file as GEMINI_API_KEY=... and restart ComfyUI. ComfyUI Manager can do the clone for you if you search "comfyui-vto" there; you'll still drop the key in .env yourself. The node reads the .env from its own folder, so that's the one fiddly bit - the key goes in ComfyUI/custom_nodes/comfyui-vto/.env, not your home directory.
Where people get burned
The "GEMINI_API_KEY not found" error means the .env is missing or mistyped - and the key is reloaded on every execution, so an edit doesn't need a full restart. The node itself prints a lot of diagnostics: if a request comes back with no candidates, it logs blockReason, which usually means Google's safety filters ate it - that's the model's policy, and no node setting bypasses it. Some regions get "Image generation is not available in your country," so check Google's available-regions page if you hit that wall.
One genuine gotcha in the code: if your google-genai is older than 1.0.0, the image_size/aspect_ratio config can silently fall back to a basic call - the node prints a "upgrade to google-genai>=1.0.0" warning, but 4K output won't work until you do.
Worth repeating, because it's the whole game: this is a pay-per-call node with your API key baked in, the exact shape of thing a malicious pack could exploit. It's open source, MIT-licensed, and tiny - glance at the source before trusting it with a key you care about. And remember the censorship axis runs with the model: if Google refuses something, the node refuses it, full stop.
It's not a replacement for local models, and it's not pretending to be. It's the single most reliable virtual try-on I've used in ComfyUI - you're just renting the reliability.
Inputs (23)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | gemini-3.1-flash-image-preview | 2 options: gemini-3-pro-image-preview, gemini-3.1-flash-image-preview |
| system_prompt | STRING | VIRTUAL TRY-ON TASK: You will receive reference images in this exact order: {image_1}, {image_2}: IDENTITY REFERENCES - These define the person's EXACT face, facial features, skin tone, skin texture, hair color, hair style, body shape, and overall physiognomy. The generated person MUST be a pixel-perfect likeness of the identity in these references. {image_3}: POSE/SCENE REFERENCE - This is your STRICT structural template. You MUST map the person onto this exact pose. Replicate the precise limb placement, hand positions, head angle, shoulder tilt, posture, and spatial depth. The camera angle, lighting, and background scene must also be duplicated exactly. {image_4}, {image_5}, {image_6}, {image_7}, {image_8}, {image_9}, {image_10}, {image_11}, {image_12}: CLOTHING REFERENCES - These show the exact garments the person must wear — replicate every fabric detail, color, pattern, texture, print, and fit precisely. CRITICAL RULES: - IDENTITY LOCK: The face and body MUST match the identity references exactly. This is the #1 priority. - POSE ISOLATION: The pose reference is a structural guide ONLY. You MUST duplicate the exact body position, posture, silhouette, and camera angle. HOWEVER, you MUST COMPLETELY IGNORE the identity, face, hair, and clothing of the person in the pose reference. Do not let them bleed into the final image. - CLOTHING ACCURACY: Garments must match the clothing references exactly. - OUTPUT: Photorealistic, high-quality, seamless composite. No blending of identities. No artistic interpretation of the face. | — |
| aspect_ratio | COMBO | 3:4 | 10 options: 1:1, 3:4, 4:3, 2:3, 3:2, 4:5, +4 |
| image_size | COMBO | 4K | 3 options: 1K, 2K, 4K |
| batch_size | INT | 11–4 | — |
| seed | INT | 00–2147483647 | — |
| temperature | FLOAT | 1.000–2 | — |
| image_1opt | IMAGE | — | |
| image_2opt | IMAGE | — | |
| image_3opt | IMAGE | — | |
| image_4opt | IMAGE | — | |
| image_5opt | IMAGE | — | |
| image_6opt | IMAGE | — | |
| image_7opt | IMAGE | — | |
| image_8opt | IMAGE | — | |
| image_9opt | IMAGE | — | |
| image_10opt | IMAGE | — | |
| image_11opt | IMAGE | — | |
| image_12opt | IMAGE | — | |
| human_pose_overrideopt | STRING | — | |
| camera_position_overrideopt | STRING | — | |
| additional_promptopt | STRING | — | |
| project_nameopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |