ComfyUI Node

Simple Anime Segmentation

The zero-knob anime cutout

By craig-tanaka·Created about a year ago·Updated about a year ago· 2
Simple Anime Segmentation
  • image
  • mask

If you generate anime art you've been here: you need the character peeled off the background - for a re-bg, an outfit swap, an inpaint, or a composite - and hand-painting a mask is the last thing you want to do. SimpleAnimeSeg is the fastest route to that mask in ComfyUI. One IMAGE in, one MASK out, not a single setting to touch. It's the lightweight half of the craig-tanaka/comfyui_animeseg pack, and it's about as plug-and-play as a custom node gets.

The brain behind it is SkyTNT's isnetis.onnx from the anime-segmentation project - the same ISNet that powers the isnet-anime preset inside rembg, which is the variant the community reached for on illustration because its edges are a clear step up from u2net. It's a salient-object network trained on anime images: it's learned what "a character" looks like and returns a foreground mask.

Mechanically, from the source, the node letterboxes your image onto the model's fixed input size, normalizes it, runs onnxruntime with CPUExecutionProvider - meaning CPU, even if you have a GPU - clamps the output to 0–1, and resizes the mask back to your original resolution with bilinear interpolation. What you get is a soft-edged full-res mask; if you want it harder, threshold it with any downstream mask node.

The inputs that matter: there's exactly one - image. The output: a single mask (MASK). That's the whole surface area. Wire the mask into a ConditioningSetMask for masked generation, a ControlNet inpaint setup, or an invert + composite for background replacement. For edge feeding or a character LoRA's reference set, this is the node you'd reach for first.

Installing it

ComfyUI Manager works: search comfyui_animeseg and install the pack. Or clone manually:

cd ComfyUI/custom_nodes
git clone https://github.com/craig-tanaka/comfyui_animeseg
cd comfyui_animeseg
mkdir -p models
curl -L -o models/isnetis.onnx https://huggingface.co/skytnt/anime-seg/resolve/main/isnetis.onnx
pip install onnxruntime

The model file (~176 MB) is the step everyone forgets. The node loads models/isnetis.onnx at init and throws if it's missing - Manager will not fetch it for you. On dependencies, torch, torchvision, pillow and numpy already ship with ComfyUI, so onnxruntime is the only genuinely new requirement.

Troubleshooting

  • Node fails to load / errors at startup: the model file isn't where the node expects it. Confirm custom_nodes/comfyui_animeseg/models/isnetis.onnx exists and isn't a 0-byte failed download.
  • It's slow: by design. The code pins CPUExecutionProvider, so installing onnxruntime-gpu changes nothing - it will not use your GPU, and a large image takes a few seconds. Fine for a single frame; don't build a batch pipeline on it.
  • It only looks at the first image in a batch (image[0]). Feed one frame at a time.
  • The mask eats the character or keeps background chunks: when the character's clothes or skin match the background closely, ISNet struggles. That's exactly the case the pack's other node - AdvancedAnimeSeg - was built for. The README is upfront that results vary with background complexity.

One more thing worth knowing before you get ideas: don't run this over a whole LoRA training dataset. A dataset stripped of backgrounds teaches the LoRA to emit blank backgrounds; the KB's advice is to keep the originals and caption honestly. This is a per-image editing tool, not a dataset cleaner.

For a character standing on a distinct background, this is the cheapest mask in ComfyUI. Just remember what "simple" means here: one model, one pass, no knobs - and the quality ceiling that comes with it.

CategoryAnime Segmentation

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
maskMASK