Anime Character Seg
Skytnt's ISNet, parked inside ComfyUI
- images
- MASK
If you've ever cut an anime character out of a generated image, you know the ritual: generate, save, open the skytnt "anime-remove-background" Space in a browser tab, upload, wait, download. Anime Character Seg is that exact model - ISNet - living inside your graph, so the cutout becomes one node instead of a detour to a web page. You drop in an image, you get a mask back, done.
It's worth knowing where it came from, because that's the whole pitch. This is a fork of abg-comfyui, which wrapped the skytnt anime-seg Space - the model the community has been pointing each other at for years when the job is "remove background from anime/illustration." ISNet's anime variant is tuned for the flat colors and clean lineart of drawn art, and it has been consistently better at that than generic background removers like u2net. It's not SOTA on your vacation photos - that's BiRefNet's job (now in ComfyUI core, no custom node needed). But for anime it still holds its own, and the wrapper is a nice, tight one.
How it works
Under the hood it's an ONNX segmentation model run through onnxruntime. The node letterboxes your image to a 1024×1024 canvas (longest side scaled to 1024, the rest padded), runs the network, crops the mask back to your aspect ratio, and resizes it to the original resolution. Practical consequence: a 4K sprite still gets segmented at 1K and upscaled back, so the mask is only ever as crisp as 1024px of model detail. For anime that's usually fine.
One thing the README gets slightly wrong: it tells you to download isnetis.onnx by hand. You don't have to. The code auto-downloads it from skytnt/anime-seg on first load if it's missing - a 176 MB ONNX, so the first run needs network and a little patience. After that it's cached in the pack's model/ folder.
The inputs and outputs
There are two inputs, and you'll touch both.
- images (IMAGE) - your batch. It processes each one and hands back a matching set of masks.
- device (CPU / GPU, default CPU) - the only real decision. More on the trap below.
Output is a single MASK tensor, one per input image. Wire it into anything that eats a mask: a compositing chain to make the character a layer on a new background, an inpaint region you want preserved or regenerated, or a workflow that needs a character isolated from the scene. To get an actual transparent PNG you still need a step that composites the mask as alpha - this node only produces the mask itself.
Installing it
Via ComfyUI Manager, search "Anime Character Seg" (or the repo name, comfyui-anime-seg). Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/LyazS/comfyui-anime-seg.git
cd comfyui-anime-seg
pip install -r requirements.txt
Then restart ComfyUI. Dependencies are light - opencv-python, onnxruntime, onnx, numpy, Pillow - and torch plus huggingface_hub come from ComfyUI itself. No other model downloads; the ISNet file pulls itself on first use.
Where people get burned
- "GPU" isn't using your GPU. The requirements install plain
onnxruntime, which doesn't ship the CUDA execution provider - the code's provider list includesCUDAExecutionProvider, but that only exists inonnxruntime-gpu. So the default install silently runs everything on CPU even if you pick GPU. If you want CUDA,pip install onnxruntime-gpumatching your CUDA version. - Flipping
devicereloads the model. Changing it rebuilds the onnxruntime session, so you'll see a few seconds of freeze each switch. Pick one and leave it. - It's anime-tuned, not general. Feed it a photorealistic render and the mask will be mediocre. That's not a bug; use core BiRefNet for anything that isn't flat-shaded art.
- It's a single-maintainer fork. The value here is the model, not the wrapper - check the repo before building a production pipeline on it. Also, the usual ComfyUI custom-node rule applies: it runs arbitrary code on import, so give it a skim if you're paranoid.
For anime character extraction, this is still the node I'd reach for: no API, no key, one mask, done.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| device | COMBO | CPU | 2 options: CPU, GPU |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |