Boyo Mask To Image (DiffuEraser Fix)
The Tiny Node That Unblocks DiffuEraser's Video Mask Bug
- mask
- image
This node exists because another node lies about masks. The display name says it all: "Boyo Mask To Image (DiffuEraser Fix)". If you've ever loaded a DiffuEraser workflow and watched it die with a "video mask" error the moment your video was longer than three frames, this is the workaround you were told to use and never fully explained.
DiffuEraser's video editing check has a broken length test baked in - it rejects any mask it thinks is "too long," and that check misfires on completely normal videos. The practical fix is to stop feeding DiffuEraser a raw MASK tensor and hand it a plain IMAGE instead. That's the entire job of BoyoMaskToImage: it converts a mask of basically any shape into a 3-channel image, which slips past the buggy validation cleanly.
How it works
ComfyUI passes masks around in several shapes depending on which node produced them - [h, w], [b, h, w], [b, h, w, 1], or [b, 1, h, w] (batch, height, width, channel ordering varies). BoyoMaskToImage normalises all of them to [b, h, w], then expands the single channel out to three so the result is a standard IMAGE tensor. A mask that was black-and-white becomes a black-and-white RGB image; the values are untouched, so white still means "edit here" and black means "leave alone."
It's a one-input, one-output node. The mask input accepts any of the shapes above, and the image output is [b, h, w, 3] - wire it into whatever is rejecting your mask.
Where it fits
The cleanest use is a straightforward swap: wherever your workflow feeds DiffuEraser's mask input from a Mask node, route that mask through BoyoMaskToImage first. That unblocks videos of any length. It's also a general convenience for any other node that insists on IMAGE when you only have a mask - some inpaint and ControlNet-adjacent tools are picky about the distinction, and a few seconds of conversion beats hunting for a converter that handles every tensor layout.
Installing it
You don't install this node alone - it ships with the whole Boyonodes pack by DragonDiffusionbyBoyo:
cd ComfyUI/custom_nodes
git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
Then restart ComfyUI. ComfyUI Manager can do the same if you search for "Boyonodes" and install it there. No extra Python packages are needed for this node; it only touches torch tensors. The pack's requirements.txt is heavy (it covers the TTS and voice nodes), but you don't need any of it for Mask To Image - if Manager chokes on the full install, this node still runs.
Gotchas
- The output is grayscale-as-RGB, not a real colour image. That's correct - don't try to "fix" it.
- Values are copied, not thresholded. A soft-edged mask stays soft-edged, which is usually what you want for video inpainting so the edit blends instead of slicing.
A one-trick node, but it's the trick that makes DiffuEraser video work at all. When a display name carries a fix for a specific bug, you can bet someone hit that bug hard enough to build a node around it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |