ComfyUI Node

Min

The darken blend your workflow is missing — elementwise minimum

By CoiiChan·Created about a year ago·Updated about a year ago· 2
Min
  • imga
  • imgb
  • IMAGE
formularesult = np.minimum(imga, imgb)

The Max node in this pack is the celebrated one - the author wrote the whole README around how hard it is to find Max(a, b) in ComfyUI. Min is its quieter twin, and it's just as useful for the flip side of the same problem: keeping the darker pixel at every position. That's the "darken" blend mode from every image editor ever, and it's the natural tool for cutting a bright region out of a mask or composite.

Where you'd reach for it: you've got a background pass and a foreground mask that should punch a dark hole through something. Averaging would gray both out; multiply would crush blacks. min keeps whichever source is darker at each pixel, so a black area in either image wins - a boolean AND for images. It's also the right tool for pulling out the shadow component between two lighting passes, which is the same job Max does for highlights.

How it works

It's a pre-filled CustomScript-NumPy formula, exactly like the rest of the pack's basic nodes:

result = np.minimum(imga, imgb)

np.minimum compares element-by-element per channel and keeps the smaller value. Because it's per-channel, "darker" is really "darker in each individual color component" - a mid-gray pixel where one source is bright red and the other dark blue ends up bright in... the component that's smaller, which for compositing is usually exactly the behavior you want.

Inputs and outputs

  • formula - the script above, pre-filled and editable.
  • imga - reference image; defines output resolution (512×512 if unconnected).
  • imgb - second image; missing means an all-zero array, which makes the output all black. That's a quick way to sanity-check the wiring, actually.

One IMAGE output.

Install

ComfyUI Manager → search "FuncAsTexture", or:

cd ComfyUI/custom_nodes
git clone https://github.com/CoiiChan/ComfyUI-FuncAsTexture-CoiiNode
# restart ComfyUI

No models, no extra dependencies. Category: FunctionAsTexture.

Notes

  • Same resolution rule as every two-image node in the pack - mismatch means a NumPy shape error. The README warns about it explicitly.
  • Output stays in 0–1 when the inputs are, since a minimum of valid values can't exceed them.
  • Pair it with Max when you're compositing light passes: Min pulls shadows, Max pulls highlights, and together they give you the "darken + lighten" pair that classic compositing lives on.

It's a one-liner, but it's the one-liner you'll be glad is a drag-and-drop node instead of a remembered NumPy incantation.

CategoryFunctionAsTexture

Inputs (3)

NameTypeDefaultDescription
formulaSTRINGresult = np.minimum(imga, imgb)
imgaoptIMAGEOptional ,Reference size ,Default =(1,512,512,3)
imgboptIMAGEOptional

Outputs (1)

NameTypeDescription
IMAGEIMAGE