MiDaS Mask Image
Cut out a subject by depth, not by color
Most masking nodes work off color, edges, or a text prompt. MiDaS Mask Image works off distance from the camera - it runs monocular depth estimation on your image, then paints everything outside a depth range a solid color of your choosing. Instead of tracing around your subject or hoping a segmentation model recognizes it, you're carving the image up by "how far away is this pixel," which is a genuinely different tool to have in the box, especially for subjects that don't have clean edges or a name a text-prompted masker could latch onto (smoke, hair, foliage, anything semi-transparent).
Under the hood this is MiDaS, the depth model Intel ISL put out back in 2019-2022 that was the default ControlNet depth preprocessor for most of the SD 1.x/2.x era before Depth Anything and friends took over on raw accuracy. It's since been passed on the leaderboard, but for a job like this - cutting a rough foreground/background split rather than feeding precise geometry into ControlNet - its speed and characteristically sharp edges are exactly what you want. You're not doing careful conditioning here, you're drawing a line in space and painting one side of it.
The node takes your image, estimates a depth map internally, and lets you define a depth cutoff (or range) plus a background color for whatever falls outside it. You can optionally feed it a specific model from WAS's own MiDaS Model Loader node if you want control over which MiDaS variant runs; skip that and it'll load a sensible default on its own. The output is an IMAGE - your original photo with everything outside the depth window replaced by the color you picked - not a boolean MASK, so wire it straight into a Preview/Save, or into whatever downstream node needs an already-isolated subject. If you specifically need a MASK for inpainting, run the output through one of WAS's other mask-conversion nodes rather than expecting this one to hand you a mask directly.
Getting it installed: the easiest route is ComfyUI Manager - search "WAS Node Suite" and install. Doing it by hand: cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui, then run pip install -r requirements.txt (use python_embeded\python.exe -s -m pip install -r requirements.txt on a portable install, or activate your venv first on a manual one), then restart ComfyUI. First launch drops a was_suite_config.json file into the node's folder - most of the suite's model-path and codec settings live there if you ever need to tweak them. Like WAS's BLIP nodes, expect the MiDaS depth model to download itself the first time you actually run this node rather than at install time.
Where it bites: WAS Node Suite hasn't had active development since December 2023 - the README literally has "(Retired)" in the title - so if it stops importing after you update ComfyUI, you're debugging it yourself rather than waiting on a fix. That's a real, recurring complaint in the community: people hit "Import Failed" after a ComfyUI or Python environment update, and WASasquatch himself has noted in the past that upgrades can quietly shift dependency versions the suite was built against. If that happens, check the GitHub issues before assuming your setup is broken - chances are someone's already found the workaround. On the depth side, monocular depth estimation is still a guess from a single 2D image: cluttered scenes, very close-up subjects, or low-contrast backgrounds can all confuse MiDaS enough that your depth cutoff doesn't land where you expect, so don't be surprised if you need to nudge the range a couple of times before the mask looks right.
Inputs (0)
No inputs
Outputs (0)
No outputs