Qwen Template Builder
System-prompt templates for Qwen-Image-Edit
- template_output
- debug_info
Because Qwen-Image-Edit reads your prompt through a language model, the system prompt - the hidden instruction that frames the whole request - actually matters. QwenTemplateBuilder is where you pick or write that system prompt. It ships with nine ready-made templates for common edit intents (default edit, text-to-image, multi-image, inpainting, artistic, photorealistic, minimal edit, technical, raw) loaded from markdown files in the pack, and it bundles your actual prompt with the right mode so the encoder knows what kind of operation you're running.
It's a small node with an outsized effect on results, and it's easy to skip past - which is probably why it has basically no search traffic. But if your edits feel like the model isn't taking your framing seriously, the system prompt is often the missing piece.
How it works
The templates live as nodes/templates/*.md files with YAML frontmatter, and the node's JavaScript UI auto-fills the custom_system field when you pick one - so choosing "photorealistic" drops a tuned system prompt into place that you can then edit. It packages three things into a single QWEN_TEMPLATE output: your prompt, the chosen mode, and the system prompt. That single-wire design is deliberate - one output carries everything the encoder needs, instead of you routing mode and system prompt separately and getting them out of sync.
The template mode you pick here is meant to match the encoder's mode. default_edit for an edit, default_t2i for generation from scratch, inpainting for masked work, and so on. Mismatching them is a classic way to get a confusing result.
The inputs and outputs that matter
prompt(required) - your actual instruction or scene description.template_mode(defaultdefault_edit) - which of the nine templates to use:artistic,default_edit,default_t2i,inpainting,minimal_edit,multi_image_edit,photorealistic,raw,technical.custom_system(required field, can be empty) - the system prompt text. Pick a template and the UI fills this; edit it to customize, or write your own from scratch with therawmode.
Outputs: template_output (the QWEN_TEMPLATE bundle - wire it into the template_output/template_input socket on QwenVLTextEncoder or the advanced encoder) and debug_info so you can see the assembled system prompt.
How to install it
ComfyUI Manager: search ComfyUI-QwenImageWanBridge, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/fblissjr/ComfyUI-QwenImageWanBridge
then restart. No model download - the templates are text files inside the pack. It feeds a Qwen encoder that does need the Qwen2.5-VL weights.
Common issues & troubleshooting
The template did nothing. Make sure template_output is actually connected to the encoder's template input. The README is explicit that the connection has to be made for the system prompt to reach the model - an unconnected builder is just a text box.
Mode mismatch weirdness. Your template_mode here should line up with the mode on your encoder. Building a default_t2i template and feeding it into an image_edit encode sends the model conflicting signals. Keep them in agreement - or use the QwenTemplateConnector helper, which carries the mode through so they stay synced.
You want total control. Use the raw template mode and write custom_system yourself. That skips the packaged system prompts entirely and hands the model exactly your words - the right choice when the presets are fighting you.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Your main prompt text | |
| template_mode | COMBO | default_edit | Choose template mode. Templates loaded from nodes/templates/*.md files. Use custom_system field to edit any template. |
| custom_system | STRING | Override system prompt - works with ANY template mode (leave empty to use default). JavaScript UI auto-fills this when you select a template. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| template_output | QWEN_TEMPLATE | — |
| debug_info | STRING | — |