Nodes/Region Edit Toolkit/图像分区 · 参考图来源选择
ComfyUI Node

图像分区 · 参考图来源选择

Pick which photo the face edit actually references, from one clean switch

By Liu-Bot24·Created 2 months ago·Updated about a month ago· 1
图像分区 · 参考图来源选择
  • direct_identity_reference
  • gpt_identity_reference
  • selected_reference
enable_local_preprocessfalse
enable_gpt_preprocessfalse

In the toolkit's identity workflows, the reference photo can come from two places: a straight copy of the source image you loaded, or a version that's been through a preprocessing stage (local preprocessing, or an LLM/GPT-driven pass) before it becomes the identity reference. RegionEditReferenceSourceSelector is the small valve that decides which of those two candidates actually gets used, and it's a good example of the pack's "graph economy" philosophy - one switch instead of two duplicated branches.

The mechanics are simple and worth understanding because they're built on a ComfyUI lazy-evaluation trick. The node has two image inputs, direct_identity_reference and gpt_identity_reference, plus two booleans, enable_local_preprocess and enable_gpt_preprocess. If either of the two preprocess booleans is true, it routes gpt_identity_reference through; otherwise it routes direct_identity_reference. That's it - the whole selection logic is "any preprocess enabled? use the preprocessed one."

The clever part is the lazy handling. Both image inputs are marked lazy, meaning ComfyUI won't evaluate the upstream branch that isn't selected - if you're on the direct route, the whole preprocessing pipeline never runs, saving the computation. And if the chosen input isn't connected, the node raises a clear "Selected X image is not connected" error instead of silently passing garbage. The source comments note a deliberate design choice: direct_identity_reference is input 0, so when the entire stage-0 preprocessing group is bypassed, ComfyUI's normal BYPASS mapping sends output 0 straight through - the node becomes a no-op passthrough and your workflow still works.

Output is a single selected_reference image, which feeds whatever identity conditioning node comes next. enable_local_preprocess vs enable_gpt_preprocess both end up at the same route - the distinction is documentation of why the preprocessed path is active, not different behavior. So the practical usage is: leave both off and wire your plain reference into direct_identity_reference; when you build out a preprocessing stage, wire its output into gpt_identity_reference and flip one of the booleans.

Why you'd bother: when you're iterating on whether preprocessing the reference (cleaning it up, adjusting lighting, or having an LLM produce a "photography brief" first) actually improves identity transfer, this node lets you flip between raw and processed reference with one boolean instead of rewiring the graph. That's an A/B switch, and it's the right tool for the job.

Install: ComfyUI Manager → search Region Edit Toolkit (registry ID native-region-tile-planner-merge), or git clone https://github.com/Liu-Bot24/ComfyUI-Region-Edit-Toolkit.git into custom_nodes, pip-install requirements.txt into ComfyUI's actual Python, restart.

One honest caveat, given this pack is new and quiet: the "GPT" in gpt_identity_reference describes the preprocessing route in the pack's own example workflows, not a built-in GPT service - nothing here calls an API. The node just picks between two images. Don't go hunting for an API key that doesn't exist; the whole toolkit is explicitly offline-friendly.

CategoryRegion Edit Toolkit/Workflow

Inputs (4)

NameTypeDefaultDescription
direct_identity_referenceIMAGE
gpt_identity_referenceIMAGE
enable_local_preprocessBOOLEANfalse
enable_gpt_preprocessBOOLEANfalse

Outputs (1)

NameTypeDescription
selected_referenceIMAGE