Nodes/ComfyUI-Image Selector by Prompt/Adv Image Selector by Prompt -- HooToo
ComfyUI Node

Adv Image Selector by Prompt -- HooToo

Pick Your Reference Images From the Prompt, Not a Rewire

By colorAi·Created 10 months ago·Updated 10 months ago· 29
Adv Image Selector by Prompt -- HooToo
  • image_A
  • image_B
  • image_C
  • image_D
  • image_E
  • image_F
  • image_G
  • image_H
  • image_I
  • image_J
  • image_K
  • image_L
  • image_M
  • image_N
  • image_O
  • output_1
  • output_2
  • output_3
  • output_4
  • output_5
  • prompt
promptA photo of {@cat_image} and {@dog_image}.
name_A
name_B
name_C
name_D
name_E
name_F
name_G
name_H
name_I
name_J
name_K
name_L
name_M
name_N
name_O

You've built a Qwen-Edit 2509 batch workflow with a pile of character and scene reference images wired in, and you're tired of rewiring the graph every time you want a different shot to use a different reference. That's exactly the job this node exists for. It's a switch, but the "switch" lives inside your prompt text: you tag each reference image with a keyword, then mention that keyword in your prompt and the right image flows through. Same idea as the Switch nodes in the rgthree-style utility packs, except the selection is prompt-driven instead of toggled by hand. It doesn't generate anything, it doesn't call an API, and it needs no key - it's pure plumbing, and plumbing is the whole point.

The README for the pack (from colorAi, the same author who posts on r/comfyui as Hongtao_A) is built around a single workflow: Qwen Edit 2509 with a TextEncodeQwenimageEditPlus encoder. If you're not running that, most of this node's value evaporates - worth knowing before you bother.

How it works

The mechanism is refreshingly simple once you read the source (image_selector_node.py). You write placeholders in your prompt using {@name} syntax, like 近景,{@A}和{@D}并肩坐在洒满阳光的地毯上…. A regex pulls out every {@...} in order, and each one is matched against your connected reference images. The first five matched images come out of output_1 through output_5, in the order the placeholders appear - not the order you wired the inputs. Meanwhile the node rewrites your prompt, swapping each {@A} for 参考图1, {@B} for 参考图2, and so on. That Chinese "reference image 1" label is the exact scheme Qwen-Edit's text encoder expects, which is why this slots in cleanly: the rewritten prompt goes straight into TextEncodeQwenimageEditPlus, and the images ride along on their own wires.

The inputs and outputs that matter

There are only two things you actually set. Everything else is optional and wires up in seconds:

  • prompt - the required multiline string holding your {@name} placeholders. This is where the selection happens.
  • image_A through image_O with matching name_A through name_O - up to 15 reference images. Leave a name empty and that image is addressed by its letter (A, B, …); set a name and you can write {@明日香} instead of {@A}.

The outputs are five IMAGE slots plus a STRING prompt output. Wire output_1output_5 into the encoder's image inputs and the rewritten prompt into its text input, and you're done.

Install

No dependencies, no model downloads - the pyproject.toml lists zero dependencies and there's no requirements.txt, which makes this one of the rare custom nodes that can't drag your environment into dependency hell. Two ways in:

# ComfyUI Manager: search "Image Selector by Prompt"
cd ComfyUI/custom_nodes
git clone https://github.com/colorAi/comfyui-ImageSelectorbyPrompt

Restart ComfyUI, search the node menu for "Adv Image Selector by Prompt -- HooToo" (the display name is more ornate than the node deserves), and you're set.

Gotchas

Three things will bite you, all visible in the source. First, a placeholder that doesn't match any connected image doesn't error - it silently emits a 64×64 black image. Feed that into the encoder and your "missing reference" becomes a black patch in the output, which is at least a loud clue. Second, only the first five placeholders in your prompt get images; if you write {@A}{@B}{@C}{@D}{@E}{@F}, the sixth is dropped while your rewritten prompt still references 参考图6. Keep your prompt to five placeholders or fewer. Third, custom-name matching is exact, so {@asuka} won't find 明日香 - the letters are the more forgiving path.

It's a niche tool with a narrow audience: if you're batch-producing shots with per-shot character references in Qwen Edit, it genuinely saves you from rewiring, and the zero-dependency install is a relief. If you're not on that workflow, it's just a curiosity. The author also built a standalone front-end doing the same thing outside ComfyUI (linked in the README), if that workflow sounds good but the graph doesn't.

CategoryImage Processing

Inputs (31)

NameTypeDefaultDescription
promptSTRINGA photo of {@cat_image} and {@dog_image}.
image_AoptIMAGE
name_AoptSTRING
image_BoptIMAGE
name_BoptSTRING
image_CoptIMAGE
name_CoptSTRING
image_DoptIMAGE
name_DoptSTRING
image_EoptIMAGE
name_EoptSTRING
image_FoptIMAGE
name_FoptSTRING
image_GoptIMAGE
name_GoptSTRING
image_HoptIMAGE
name_HoptSTRING
image_IoptIMAGE
name_IoptSTRING
image_JoptIMAGE
name_JoptSTRING
image_KoptIMAGE
name_KoptSTRING
image_LoptIMAGE
name_LoptSTRING
image_MoptIMAGE
name_MoptSTRING
image_NoptIMAGE
name_NoptSTRING
image_OoptIMAGE
name_OoptSTRING

Outputs (6)

NameTypeDescription
output_1IMAGE
output_2IMAGE
output_3IMAGE
output_4IMAGE
output_5IMAGE
promptSTRING