Doom Image Router
Sort your batch by width, aspect, or index — the routing node for the loader's metadata
- image
- meta
- image_1
- image_2
- image_3
- image_4
- fallback
- route_info
Doom Image Router is the pack's "which of these four pipelines does this image belong to?" node. It takes an image plus its metadata, checks up to four output slots, each with up to two conditions, and routes the image to the first slot whose conditions pass. If none match, it passes the image through to fallback untouched. It's the conditional-branching half of the batch system - DoomImageLoader feeds it images and metadata, and it decides where each one goes.
Why you'd want that: batch pipelines rarely want to treat every image the same. A dataset of mixed landscape/portrait shots might route portraits to a portrait-resize + img2img path and landscapes to a different sampler config. An index-driven job might process every 3rd image differently. Doing that with stock ComfyUI means ConditionalSwitch gymnastics and nodes that don't actually read image properties. This node reads the properties directly.
How it works
The meta input is the key - it's the dict from DoomImageLoader (filename/width/height/aspect/index/total/source), and the conditions all test against it:
width_min/width_max,height_min/height_max- numeric ranges against the metadataaspect_min/aspect_max- w/h ratio thresholdsindex_eq- index equals a valueindex_mod- index is a multiple of the value (every N-th image)name_contains- filename substring
Each of up to outputs_count (1–4) slots has two condition slots (outN_cond1_type/_value, outN_cond2_type/_value). Within a slot, both conditions must pass (AND). Between slots, it's first-match-wins: the first slot whose conditions pass routes the image, and the rest of the outputs come out empty.
Outputs are image_1 through image_4, plus fallback (the original image when nothing matched) and route_info, a string that says routed_to_N or fallback so you can log or display what happened. Note the output images are the same image on whichever slot won - the router doesn't transform anything, it just directs.
One honest quirk: the condition values are all float widgets. That's fine for width/height/aspect/index math, but it makes name_contains awkward in practice - you're typing a filename fragment into a number box. Use it if it works for you, but the numeric conditions are the ones this node is genuinely good at.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/PeterMikhai/Doom_Flux_NodePack
Restart or ComfyUI Manager. No extra deps; current ComfyUI. README's DoomAI_nodes.git line is stale - repo is Doom_Flux_NodePack.
Common issues
- "The router sends everything to fallback." Almost always a metadata problem - the
metainput needs to be the dict fromDoomImageLoader(or anything with the same keys). Wire the loader'smeta_a/meta_boutputs, don't improvise. - Conditions that always pass.
noneas a condition type passes unconditionally - so a slot with cond1=noneis an "always route here" slot, and since it's first-match-wins, anything below it never fires. That's the classic misconfiguration: a stray default-nonecondition swallowing your routing. outputs_countvs. which outputs you read. Only the firstoutputs_countslots are checked; outputs beyond that are just unused. Set it to the number of slots you actually configured.- Name matching feels broken - the value widget is a float; if you entered a name fragment it may not behave like string matching. Prefer numeric conditions.
It's a small, deterministic branching node. When your batch job needs "this size goes here, that size goes there," it turns a routing problem into four dropdowns.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Входное изображение | |
| meta | DICT | Метаданные (от DoomImageLoader) | |
| outputs_count | INT | 21–4 | Сколько выходов проверять (1-4) |
| out1_cond1_type | COMBO | none | Условие 1 выхода 1 |
| out1_cond1_value | FLOAT | 0.00 | Значение условия 1 выхода 1 |
| out1_cond2_type | COMBO | none | Условие 2 выхода 1 |
| out1_cond2_value | FLOAT | 0.00 | Значение условия 2 выхода 1 |
| out2_cond1_type | COMBO | none | Условие 1 выхода 2 |
| out2_cond1_value | FLOAT | 0.00 | Значение условия 1 выхода 2 |
| out2_cond2_type | COMBO | none | Условие 2 выхода 2 |
| out2_cond2_value | FLOAT | 0.00 | Значение условия 2 выхода 2 |
| out3_cond1_type | COMBO | none | Условие 1 выхода 3 |
| out3_cond1_value | FLOAT | 0.00 | Значение условия 1 выхода 3 |
| out3_cond2_type | COMBO | none | Условие 2 выхода 3 |
| out3_cond2_value | FLOAT | 0.00 | Значение условия 2 выхода 3 |
| out4_cond1_type | COMBO | none | Условие 1 выхода 4 |
| out4_cond1_value | FLOAT | 0.00 | Значение условия 1 выхода 4 |
| out4_cond2_type | COMBO | none | Условие 2 выхода 4 |
| out4_cond2_value | FLOAT | 0.00 | Значение условия 2 выхода 4 |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| image_1 | IMAGE | Изображение, если сработал выход 1 |
| image_2 | IMAGE | Изображение, если сработал выход 2 |
| image_3 | IMAGE | Изображение, если сработал выход 3 |
| image_4 | IMAGE | Изображение, если сработал выход 4 |
| fallback | IMAGE | Исходное изображение, если ни один выход не сработал |
| route_info | STRING | routed_to_N или fallback |