comfyui-vto
A ComfyUI custom node for photorealistic virtual try-on generation using Google's Gemini API with flexible image inputs and customizable prompts. (Description by CC)
ComfyUI Virtual Try-On Node (Gemini)
A ComfyUI custom node for photorealistic virtual try-on generation using Google's Gemini API.
Features
- Model Selection: Choose between
gemini-3-pro-image-previewandgemini-3.1-flash-image-preview - Flexible Image Inputs: Up to 12 image input slots with smart placeholder system
- Editable System Prompt: Fully customizable prompt with
{image_1}to{image_12}placeholders - Multiple Aspect Ratios: 1:1, 3:4, 4:3, 2:3, 3:2, 4:5, 5:4, 9:16, 16:9, 21:9
- Resolution Control: 1K, 2K, or 4K output
- Temperature Control: Adjust creativity vs consistency (0.0 - 2.0)
- Batch Generation: Generate 1-4 images per execution
- Seed Control: Reproducible results with seed parameter (0 = random)
- Graceful Input Handling: Unconnected image inputs are automatically skipped
- Optional Overrides: Fine-tune pose, camera angle, and add custom prompts
Installation
1. Install the Node
Clone directly into your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/
git clone https://github.com/YOUR_USERNAME/comfyui-vto.git
Or manually copy the comfyui-vto folder into ComfyUI/custom_nodes/.
2. Install Dependencies
cd ComfyUI/custom_nodes/comfyui-vto
pip install -r requirements.txt
3. Configure API Key
cp .env.example .env
Edit .env and add your Gemini API key:
GEMINI_API_KEY=your_actual_api_key_here
Get your API key from: https://aistudio.google.com/app/apikey
4. Restart ComfyUI
Restart ComfyUI to load the new node.
Usage
Quick Start
- Search for "Virtual Try-On (Gemini)" in the node browser
- Select your model from the dropdown
- Connect your images to the input slots
- Set aspect ratio, resolution, temperature, and batch size
- Execute the workflow
Default Image Layout
The default system prompt expects images in this order:
| Input | Role |
|-------|------|
| image_1, image_2 | Identity references (face, body, features) |
| image_3 | Pose and scene reference |
| image_4 - image_12 | Clothing and accessory references |
Only connected inputs are sent to the API. Unconnected slots are automatically skipped.
Custom Prompt
You can rewrite the system prompt to change how images are used. Reference images with {image_1} through {image_12} placeholders:
Use {image_1} for identity, {image_2} for pose, and {image_3} to {image_6} for clothing.
Parameters
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| model | Dropdown | gemini-3.1-flash-image-preview | Gemini model to use |
| system_prompt | String | VTO prompt | Main instruction with image placeholders |
| aspect_ratio | Dropdown | 3:4 | Output aspect ratio |
| image_size | Dropdown | 4K | Output resolution (1K, 2K, 4K) |
| batch_size | Int | 1 | Images to generate per run (1-4) |
| seed | Int | 0 | Seed for reproducibility (0 = random) |
| temperature | Float | 1.0 | Creativity control (0.0 = deterministic, 2.0 = max variation) |
| image_1 - image_12 | Image | Optional | Image inputs |
| human_pose_override | String | Empty | Override pose from text description |
| camera_position_override | String | Empty | Override camera angle from text description |
| additional_prompt | String | Empty | Extra context or instructions |
| project_name | String | Empty | Project identifier (for reference) |
Tips
- Identity: Use 2+ high-quality photos of the same person for best likeness
- Pose: Use a clear, well-lit photo with the desired body position
- Clothing: Multiple angles of clothing items improve accuracy
- Temperature: Lower values (0.2-0.5) for consistent production runs, higher (1.0-1.5) for creative exploration
- Batch + Seed: Use batch_size > 1 with a fixed seed to get variations
Troubleshooting
"GEMINI_API_KEY not found"
- Ensure
.envfile exists in thecomfyui-vtofolder - Check that the API key is correctly formatted
- Restart ComfyUI after creating/editing
.env
"Image generation is not available in your country"
- Some Gemini models have regional restrictions
- Try switching to a different model in the dropdown
- Check Google's available regions
"No images connected"
- Connect at least one image input before generating
Import Errors
- Run
pip install -r requirements.txtin thecomfyui-vtofolder - Ensure you're using the same Python environment as ComfyUI
API Costs
This node uses Google's Gemini API. Check current pricing at: https://ai.google.dev/pricing
License
MIT License - See LICENSE file for details.