Nodes/ComfyUI-QwenImageWanBridge/Qwen Spatial Token Generator
ComfyUI Node

Qwen Spatial Token Generator

An honest experiment in spatial tokens for Qwen

By fblissjr·Created 12 months ago·Updated 4 months ago· 188
Qwen Spatial Token Generator
  • image
  • annotated_image
  • prompt
  • debug_info
prompt
output_formatstructured_json
debug_modefalse

Let's lead with the honest part, because the author does: the pack's README describes this as a "visual editor for spatial tokens that don't seem to do much of anything right now." So this article is less "here's how to get great results" and more "here's what this is trying to do, and why it's interesting even when it doesn't work." If you came looking for a reliable spatial-control node, this isn't it yet. If you came curious, read on.

The idea is genuinely worth understanding. Qwen's vision-language encoder (Qwen2.5-VL) knows about grounding - it can talk about coordinates and bounding boxes, because it was trained to point at things in images. The tantalizing question this pack keeps poking at is: if the text encoder understands spatial tokens, does the diffusion model downstream actually listen to them? Can you write "a cat at [x1,y1,x2,y2]" and have it land there? That's the same dream as regional prompting, except native to the token stream instead of bolted on with masks. The one 2026 model that pulls it off, Ideogram 4, does it by making bounding boxes part of the caption schema it was trained on - not something you add afterward. Qwen-Image wasn't trained that way, which is likely why the effect here is faint.

How it works

You give it an image and a prompt, pick an output_format, and it generates spatial token annotations describing where things are, emitting them in whatever notation you asked for. It also draws those regions back onto the image so you can see what it produced. The point is experimentation: generate the tokens, feed them into your encoder, and observe whether the DiT responds. Mostly, right now, it doesn't much - but the formats let you test which representation, if any, moves the needle.

The inputs and outputs that matter

  • image - the reference the spatial tokens describe.
  • prompt - what you're annotating or asking to place.
  • output_format (structured_json / xml_tags / natural_language / traditional_tokens) - the notation the tokens come out in. This is the real experiment: different encoders may respond to different shapes, and trying all four is the intended use.
  • debug_mode - turns on the verbose reporting you'll want while poking at this.

Outputs: annotated_image (regions drawn on the picture), prompt (the generated spatial-token string to feed downstream), and debug_info.

How to install it

ComfyUI ManagerComfyUI-QwenImageWanBridge → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/fblissjr/ComfyUI-QwenImageWanBridge

then restart. The token generation leans on the Qwen tokenizer/VL side of the pack, so a Qwen-Image or Qwen-Image-Edit setup is the context you'd run this inside.

Common issues & troubleshooting

Nothing happens in the output image. That is, unfortunately, the expected outcome much of the time - the author says so plainly. Qwen-Image wasn't trained with box conditioning in its caption schema, so spatial tokens don't have a reliable hook to grab. This isn't a misconfiguration on your end.

Which format should I use? Nobody knows yet, which is exactly why there are four. Try structured_json first, then compare against natural_language; if you find one that actually shifts placement on your model, that's a genuine research finding worth sharing.

I need real regional control today. Then don't fight this. Use mask-based regional prompting - the pack's own QwenEliGenEntityControl, or a mature regional node for your architecture - which conditions on painted areas instead of hoping the model reads coordinates. This node is a sandbox for a future that isn't here on Qwen yet.

CategoryQwen/Spatial

Inputs (4)

NameTypeDefaultDescription
imageIMAGEInput image for spatial editing
promptSTRING
output_formatCOMBOstructured_jsonstructured_json: JSON commands (recommended) | xml_tags: HTML-like elements (most native) | natural_language: coordinate sentences | traditional_tokens: legacy format
debug_modeBOOLEANfalse

Outputs (3)

NameTypeDescription
annotated_imageIMAGE
promptSTRING
debug_infoSTRING