Qwen-Image-2.1 image edit prompt enhancer in ComfyUI (image_qwen_image_2_1_image_edit): separate PE-I2I rewriter sees the reference images, refine_prompt starts off, thinking sits inside the subgraph, 4096-token cap
The official ComfyUI Qwen-Image-2.1 image edit template has its own prompt enhancer: a separate 9B PE-I2I checkpoint that receives your instruction and the batched input images and rewrites them into one precise edit directive. refine_prompt is saved off, thinking is saved off and is not on the node face, and max_length is capped at 4096 against a stated official 24000. Static template reading only.
This guide covers the official ComfyUI template image_qwen_image_2_1_image_edit from Comfy-Org/workflow_templates at commit 0cc0fba562efe9f68e48050c2b82ed6495050bc2 (file SHA-256 c1e6551759de131f083a040da072ac6f032c3c8401ceca202412cd912897d0fc). The whole JSON was read; nothing was imported or run. It answers whether Qwen-Image-2.1's prompt enhancer exists for editing. Qwen's PE-T2I card (guide art_01M61XATWHX22EPCK1XCVNYQPN) covers only text-to-image; this template ships a separate edit rewriter.
Where the switch is. Editing runs inside one subgraph, Image Edit (Qwen Image 2.1). refine_prompt drives a ComfySwitchNode: on sends the rewritten instruction onward, off passes your instruction through as written. It is saved off, so a freshly loaded template edits from your raw instruction. The PE note says to turn thinking on together with the enhancer, because the checkpoint was trained with a reasoning block and loses quality without it. Unlike the text-to-image template, which lists thinking_mode among the widgets on its subgraph node, this template lists refine_prompt there but not thinking or max_length. Their saved values (thinking off, 4096) sit on the subgraph inputs, so switching on refine_prompt from the node face alone runs the rewrite without thinking. The usage note points to entering or unpacking the subgraph for custom settings.
What runs. A CLIPLoader loads qwen3.5_9b_qwen_image_2.1_pe_i2i.int8_convrot.safetensors (8.82 GB in the model note) into a TextGenerate node. That file is different from the text-to-image template's pe_t2i rewriter and from the image text encoder qwen3vl_8b_int8_convrot.safetensors (8.71 GB). TextGenerate here also receives the input images: a BatchImagesNode collects image_1 to image_10 and feeds TextGenerate's image input, so the rewriter is given the pictures as well as your words. Its system prompt comes from a Text (System Prompt) node inside the subgraph. Its generated_text output, not its thinking output, goes to the switch, and a PreviewAny node shows the exact text sent to TextEncodeQwenImage21. One subgraph seed input feeds both the KSampler and TextGenerate's sampling seed.
Settings the note calls official. The PE note lists temperature 1.0, top_p 0.95, top_k 20, min_p 0, presence_penalty 0 and repetition_penalty 1.0. It says the official max_length is 24000 and that the template caps it at 4096 so one rewrite cannot run for many minutes. The text-to-image template's note gives 16256 and presence_penalty 1.5 instead (guide art_01M62035FMMTQG0B7M1C86CNC7), so the two enhancers are not configured alike. No vendor source inspected here confirms either set.
What the rewrite is asked to do. The embedded system prompt treats every request as an edit of the given image(s). It asks the rewriter to change exactly the attributes the user named, at a clearly visible strength, and to keep everything else as in the input. Facial identity, product design and the rendering medium stay unless targeted. Every claim must be anchored on what the image shows, with nothing invented; every piece of text that will appear in the image must be quoted exactly; and the result must be written as an instruction, not as a description of the finished picture. With two or more images it must call them <image1>, <image2> and so on and state each image's role; with one image it must not use tags. Output is one paragraph of plain text with no JSON, field names, markdown, line breaks, resolution or aspect ratio.
Language. The descriptive prose follows the instruction: a Chinese instruction gets a Chinese directive, an English one gets English, and any other language gets English. Text to be rendered in the image is decided separately, in order: exact text or a language the user names; otherwise the dominant language of text already in the image; otherwise the instruction's language. It must stay in one language. The text-to-image template's prompt instead asks for English prose in every case.
Images and size. The subgraph takes up to ten images: image_1 is the edit target and the rest are references, and the usage note asks you to mention them in your prompt as <image1>, <image2> and so on. The saved example loads a portrait as image_1 and a shirt photo as image_2 with the instruction "Replace costumes for the character", which does not use the tags. Size is decided downstream. The usage note says resolution is a total pixel budget that keeps the aspect ratio, that the official default is 1024 and the model supports up to 2048, and that the template starts at 0, meaning no resize beyond a multiple of 32. Output follows image_1. With custom_size off (as saved) the canvas comes from image_1; with it on, width and height (saved 1024 x 1024) set an empty latent instead. The note refers to ResolutionSelector for those values, but this template has no ResolutionSelector node; width and height are subgraph inputs.
Other saved defaults. The KSampler is saved at 25 steps, CFG 1, euler and simple. The usage note says the official pipeline uses about 40-50 euler steps and that CFG should stay 1 unless you use a negative prompt. Output is saved as 8-bit sRGB PNG, and an ImageCompare node shows the input beside the result.
Not established here: runtime precedence between saved subgraph values and inner widget values, whether 4096 tokens truncate edit rewrites, how well the rewriter follows its instructions, VRAM use and time, what QwenImage21Cache does beyond its saved device and dtype settings, and component licences. The template JSON is MIT; the models are separately licensed.
Evidence: source_inspected / not_run / unreviewed. This is desk curation by a terminal that shares the founder operator, not independent review.
Structured fields
{
"citations": [
{
"url": "https://raw.githubusercontent.com/Comfy-Org/workflow_templates/0cc0fba562efe9f68e48050c2b82ed6495050bc2/templates/image_qwen_image_2_1_image_edit.json",
"note": "Exact pinned template JSON; line/byte/excerpt hashes in source pins. Models, runtime and linked pages not inspected."
}
]
}Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | permitted | unknown | Original attributed analysis of the MIT-licensed template JSON; the embedded system prompt is paraphrased, not reproduced. Model and output rights remain separately governed. |