Nodes/Doom_Flux_NodePack/Doom Image Router
ComfyUI Node

Doom Image Router

Sort your batch by width, aspect, or index — the routing node for the loader's metadata

By PeterMikhai·Created about a year ago·Updated 6 days ago· 1
Doom Image Router
  • image
  • meta
  • image_1
  • image_2
  • image_3
  • image_4
  • fallback
  • route_info
outputs_count2
out1_cond1_typenone
out1_cond1_value0.00
out1_cond2_typenone
out1_cond2_value0.00
out2_cond1_typenone
out2_cond1_value0.00
out2_cond2_typenone
out2_cond2_value0.00
out3_cond1_typenone
out3_cond1_value0.00
out3_cond2_typenone
out3_cond2_value0.00
out4_cond1_typenone
out4_cond1_value0.00
out4_cond2_typenone
out4_cond2_value0.00

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 metadata
  • aspect_min / aspect_max - w/h ratio thresholds
  • index_eq - index equals a value
  • index_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 meta input needs to be the dict from DoomImageLoader (or anything with the same keys). Wire the loader's meta_a/meta_b outputs, don't improvise.
  • Conditions that always pass. none as a condition type passes unconditionally - so a slot with cond1=none is 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-none condition swallowing your routing.
  • outputs_count vs. which outputs you read. Only the first outputs_count slots 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.

CategoryDoom/Utils

Inputs (19)

NameTypeDefaultDescription
imageIMAGEВходное изображение
metaDICTМетаданные (от DoomImageLoader)
outputs_countINT21–4Сколько выходов проверять (1-4)
out1_cond1_typeCOMBOnoneУсловие 1 выхода 1
out1_cond1_valueFLOAT0.00Значение условия 1 выхода 1
out1_cond2_typeCOMBOnoneУсловие 2 выхода 1
out1_cond2_valueFLOAT0.00Значение условия 2 выхода 1
out2_cond1_typeCOMBOnoneУсловие 1 выхода 2
out2_cond1_valueFLOAT0.00Значение условия 1 выхода 2
out2_cond2_typeCOMBOnoneУсловие 2 выхода 2
out2_cond2_valueFLOAT0.00Значение условия 2 выхода 2
out3_cond1_typeCOMBOnoneУсловие 1 выхода 3
out3_cond1_valueFLOAT0.00Значение условия 1 выхода 3
out3_cond2_typeCOMBOnoneУсловие 2 выхода 3
out3_cond2_valueFLOAT0.00Значение условия 2 выхода 3
out4_cond1_typeCOMBOnoneУсловие 1 выхода 4
out4_cond1_valueFLOAT0.00Значение условия 1 выхода 4
out4_cond2_typeCOMBOnoneУсловие 2 выхода 4
out4_cond2_valueFLOAT0.00Значение условия 2 выхода 4

Outputs (6)

NameTypeDescription
image_1IMAGEИзображение, если сработал выход 1
image_2IMAGEИзображение, если сработал выход 2
image_3IMAGEИзображение, если сработал выход 3
image_4IMAGEИзображение, если сработал выход 4
fallbackIMAGEИсходное изображение, если ни один выход не сработал
route_infoSTRINGrouted_to_N или fallback