comfyui_generate_image
Create images from text, edit a reference image while preserving subject identity, or resize and remove backgrounds. Get a prompt ID to poll or wait for direct image URLs.
Instructions
Generate, modify, or post-process images using ComfyUI. Three modes (auto-detected):
txt2img: Provide prompt → generates image from text
img2img: Provide prompt + image_path → edits the reference image using Flux 2 Klein's native edit pattern (ReferenceLatent + CFGGuider), which preserves character/subject identity far better than classic denoise-based img2img. Best results at ~1MP references; 128×128 inputs will be upscaled before encoding.
post-process: Provide image_path without prompt → resize and/or remove background only
By default, returns immediately with a prompt_id and status 'queued'. Use comfyui_get_image to poll for completion and retrieve image URLs. Set wait: true to block until the image is ready (or fails/times out) and get image URLs directly in the response.
Parameters:
prompt (string, optional): Text description of desired image
negative_prompt (string, optional): What to avoid in the image
image_path (string, optional): Absolute path to input image (triggers img2img or post-process)
width/height (int, optional): Target output dimensions (triggers resize post-processing)
remove_background (boolean, optional): Remove background from output image
loras (array, optional, max 4): LoRA stack. Each entry: { name, strength_model (-2..2, default 1.0), strength_clip (optional, defaults to strength_model) }. Omit to fall back to COMFYUI_DEFAULT_LORAS env (if set). Pass [] to explicitly disable defaults. Use comfyui_list_loras to discover available names.
wait (boolean, optional, default false): Block until image is ready and return URLs directly
Must provide at least prompt or image_path.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "comfyui_generate_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wait | No | ||
| loras | No | ||
| width | No | ||
| height | No | ||
| prompt | No | ||
| image_path | No | ||
| negative_prompt | No | ||
| remove_background | No |