Nodes/ComfyUI_ZIM/ZIM Segmenter
ComfyUI Node

ZIM Segmenter

Click the object, get a matte

By judian17·Created about a year ago·Updated about a year ago· 9
ZIM Segmenter
  • image
  • bbox
  • mask
model_name
backbonevit_l
positive_points[]
negative_points[]

ZIM Segmenter is the main event of the ComfyUI_ZIM pack: an unofficial wrapper around NAVER's ZIM, the "Zero-shot Image Matting for Anything" model. Think of it as Segment Anything's cousin with one important difference - it does matting, not just segmentation. Instead of a hard on/off mask you get soft, fractional alpha, which is exactly what you want for hair, fur, glass and fuzzy edges. If you've ever fought SAM for half an hour trying to get a clean edge on a portrait, you'll see the appeal instantly.

The workflow it fits is the classic interactive masking one: you click on the object you care about, the node returns a mask, and that mask feeds an inpainting, object-replacement or compositing step. ZIM's superpower is that you guide it - a positive point says "this is the thing", a negative point says "this is not". That beats BiRefNet when you're selecting one specific object rather than "whatever the salient foreground is". If all you want is a one-click background cutout of a product shot, skip this pack entirely and use BiRefNet, which has been in ComfyUI core since May 2026.

Install - the model is the gotcha

Install the pack through ComfyUI Manager (search "ComfyUI_ZIM") or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/judian17/ComfyUI_ZIM
cd ComfyUI_ZIM
pip install -r requirements.txt

Restart ComfyUI after. Dependencies are light - zim_anything, onnxruntime-gpu, Pillow, numpy<=1.26.4. What you have to fetch yourself is the model: download zim_vit_b_2043 or zim_vit_l_2092 from naver-iv/zim-anything-vitb or naver-iv/zim-anything-vitl on HuggingFace and drop the folder into ComfyUI/models/zim/ so you end up with models/zim/zim_vit_l_2092/encoder.onnx and decoder.onnx. There's no auto-download, and the model is the whole point, so this step is the one people burn on.

The inputs that matter

  • model_name and backbone - the two that must agree. Pick zim_vit_l_2092 with backbone vit_l, or zim_vit_b_2043 with vit_b. vit_b is the smaller, quicker tier; vit_l is the heavier one with better masks. A mismatch is the classic way to land a load error, since the loader keys off the backbone name.
  • positive_points / negative_points - JSON strings, default "[]". Format is [[x, y], [x, y]] or [{"x": x, "y": y}]. These are the clicks that steer the mask. You almost never type them by hand - you wire in the pack's own MaskToPoints node (or KJNodes point node), which the README walks through.
  • bbox - optional bounding box, for when you'd rather draw a box than click. The README is blunt that points are the more precise prompt; use the box for speed.

How it works

The image runs through a ViT encoder once to build a feature map, then a lightweight decoder turns your prompt into a mask - so the model is cached after the first load (first run is slow, later runs aren't) and image features are cached too, which means re-segmenting the same image with different clicks is fast. The output is a single mask (MASK type), soft-edged rather than binary, ready to plug into inpaint or mask-blur-and-composite steps.

Where people get burned

A few real ones. The model must sit in exactly models/zim/ - if that folder doesn't exist the node falls back to showing default names, then throws FileNotFoundError the moment you queue it. The points are JSON with no hand-holding: malformed JSON raises ValueError, and an empty points list with no bbox raises "at least one positive point... must be provided" - usually because your source mask came out empty. And the author cheerfully admits in the README they wrote this with Gemini and aren't a Python pro, which means the console gets spammed with [ZIM DEBUG] lines and the device handling is occasionally naive. One more asterisk: NAVER's ZIM weights are non-commercial, so if you're shipping anything, check the license first.

Useful tool, clearly worth it for interactive matting. Just don't expect a polished one-click experience.

CategoryComfyUI_ZIM

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
model_nameCOMBO2 options: zim_vit_l_2092, zim_vit_b_2043
backboneCOMBOvit_l3 options: vit_l, vit_b, default
positive_pointsoptSTRING[]
negative_pointsoptSTRING[]
bboxoptBBOX

Outputs (1)

NameTypeDescription
maskMASK