Eric Qwen Inpaint Prompt Rewriter (Vision)
Let a vision model write your inpaint prompt
- image
- mask
- prompt
Here's the problem this node solves: the ControlNet inpaint models in this pack need a short, change-focused prompt that says what to put in the masked hole - not a rambling description of the whole image. But you're usually looking at a picture, thinking "I want a sunset there," and typing it out leaves most of the model's potential on the table. Eric Qwen Inpaint Prompt Rewriter sits between you and the generation node, watches the image and the mask, and writes the prompt you meant to write.
How it works
It's a vision-language-model job, and the interesting part is how it frames the input. The node takes your image plus the optional mask, draws the mask's outline onto the image (a red overlay by default - you can tune the color and width), and sends that to an OpenAI-compatible vision API. Why the outline? So the VLM actually sees where the edit region is, instead of guessing from a vague sentence. A mask outline gives it spatial awareness of what you're changing.
You describe the change in plain language (change_description), the VLM looks at the picture and the outline, and it writes a 40–80 word prompt that front-loads the new content. That brevity is deliberate: the inpaint pipeline already has the source image as conditioning, so the prompt should say what to generate, not re-describe what's already there. It also handles the outpainting case via outpaint_description - describing the extended region when there's no mask to outline.
Output is a single prompt string, and it's designed to feed straight into the pack's UltraGen Inpaint CN node's prompt input. If you want to A/B test whether the rewrite is actually helping, passthrough returns your raw change_description untouched.
Inputs that matter
image- required, the source the VLM analyzeschange_description- required, your plain-English intent ("Replace the car with a green taxi")api_url- required; defaults to LM Studio'shttp://localhost:1234/v1, but Ollama (:11434/v1) and OpenAI work toomodel- auto-detects from the server if left blank; e.g.qwen2.5-vl:7bon Ollama,gpt-4o-minion OpenAImask- the inpaint mask (white = change area); outline drawn from thislanguage,temperature,max_tokens,custom_instructions- the usual LLM controlsimage_max_side- how big the image sent to the VLM gets (bigger = more detail, more tokens)
Install & gotchas
Pack install is the standard one: ComfyUI Manager (search "Eric Qwen-Edit") or clone https://github.com/EricRollei/Eric_Qwen_Edit_Experiments.git into custom_nodes/. No extra model download - the vision model runs on whatever API server you point at. If you're going the local route, that means running Ollama or LM Studio with a VLM loaded; a text-only model like qwen3:8b can't see the image and the node will fail on the vision call. Don't run a vision model and a text model in the same breath and wonder why it errors.
The pack reads API keys from environment variables or api_keys.ini (in the pack root, git-ignored) - never stored in workflow JSON. That's a nice touch, since a plaintext key in a shared workflow is how those get leaked. And remember the division of labor: this writes short inpaint prompts. It's a different tool from the general Eric Qwen Prompt Rewriter, which produces ~200-word scene descriptions for full text-to-image generation. Wire the right one to the right node.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Source image for the VLM to analyse. | |
| change_description | STRING | Describe what you want to change in the masked area. Example: 'Replace the car with a green taxi' Example: 'Change the sky to a dramatic sunset' | |
| api_url | STRING | http://localhost:1234/v1 | OpenAI-compatible vision API URL. LM Studio: http://localhost:1234/v1 Ollama: http://localhost:11434/v1 OpenAI: https://api.openai.com/v1 |
| modelopt | STRING | Model name override. Leave empty to auto-detect the loaded model from the API server. Ollama: qwen3-vl, qwen2.5-vl:7b OpenAI: gpt-4o-mini, gpt-4o | |
| maskopt | MASK | Inpaint mask (white = area to change). A red outline will be drawn on the image for the VLM. Not needed for outpainting. | |
| outpaint_descriptionopt | STRING | What to add in the outpaint expansion area. Example: 'Mountain landscape extending into the distance' Only used when no mask is provided or when you want outpainting context in the prompt. | |
| languageopt | COMBO | English | Language for the rewritten prompt. |
| temperatureopt | FLOAT | 0.70–2 | VLM temperature. Lower = more faithful. |
| max_tokensopt | INT | 2048256–8192 | Max tokens for the VLM response. |
| outline_color_ropt | INT | 2550–255 | Mask outline red channel. |
| outline_color_gopt | INT | 500–255 | Mask outline green channel. |
| outline_color_bopt | INT | 500–255 | Mask outline blue channel. |
| outline_widthopt | INT | 31–10 | Pixel width of the mask outline. |
| custom_instructionsopt | STRING | Additional instructions for the VLM. Example: 'Use a cinematic photography style' Appended to the system prompt. | |
| passthroughopt | BOOLEAN | false | Skip VLM rewriting. Passes change_description through as-is (for A/B testing). |
| image_max_sideopt | INT | 1024256–2048 | Max pixel size (longest side) for the image sent to the VLM. Larger = more detail but slower and more tokens. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |