MinimumFilter☀
Photoshop's minimum filter, without leaving ComfyUI
- image
- IMAGE
The minimum filter is one of those Photoshop staples that ComfyUI just doesn't ship. It's the opposite of a maximum/dilate filter: for every pixel, it takes the darkest value in the surrounding neighborhood, which shrinks bright areas, thickens dark lines, and generally erodes detail. In image-prep workflows it's a matte-refinement and detail-suppression tool - the README pitches it for "matte refinement or detail suppression," and that's exactly the honest use. MinimumFilter brings it in as a single node, and it works on batches, which most PS-style filters don't bother with.
How it works
It runs skimage.filters.rank.minimum with a square structuring element of the radius you choose, per color channel. The math is the classic morphology erosion: output = min of the neighborhood, which pushes values toward black. Radius 1 is a hair, radius 3–5 starts visibly crunching detail, and past that you're aggressively flattening.
Two implementation details are worth knowing:
- It runs on CPU numpy. There's no GPU acceleration here, so on a big batch expect it to be the slow link. For pre-processing a handful of images it's fine.
- It handles batches and single images. 4D tensors get processed frame-by-frame and re-stacked, so you can run it straight on a
LoadImageListbatch.
Inputs
- image - an IMAGE tensor (single or batch).
- radius - 1 to 255, default 3. The neighborhood size for the filter.
Output is a single IMAGE. It's a filter node, so it slots in anywhere in your image chain - feed it a mask or a matte, refine, and continue.
When you'd reach for it
- Matte cleanup. Eroding a matte before compositing knocks back stray bright edge pixels.
- Detail suppression. Crushing small bright specks before an upscaler or a detail pass.
- Mask prep. When a mask has thin bright strands you want to shrink out of existence.
The obvious rival is ComfyUI's built-in Blur plus thresholding, but that's a two-node hack and it doesn't behave the same. If you know Photoshop's minimum filter, you know what this gives you.
Install
It needs scikit-image, which is in the pack's requirements.txt:
cd ComfyUI/custom_nodes
git clone https://github.com/Hasasasa/ComfyUI_DashuaiTools
cd ComfyUI_DashuaiTools
pip install -r requirements.txt
then restart ComfyUI. Or install the whole pack through ComfyUI Manager, which handles the dependency for you. The first run's import of skimage is slightly slow - that's normal, it's a chunky library.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| radius | INT | 31–255 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |