NGs Multimask - Read
Pulling one packed mask back out
- image
- Mask
The other half of the pair. NGs Multimask Write packs several boolean masks into the bit planes of a single image; this node reads one of them back out as an actual MASK you can wire into inpainting, region-conditioning, or anywhere else ComfyUI expects a mask input.
How it works
It reads the pixel values of the specified channel (red, green, or blue) and picks out a single bit at position level - the same channel/level scheme Write uses to address each mask - then returns that as a MASK.
The inputs and outputs that matter
image- a Multimask Image, i.e. output from an NGs Multimask Write chain.channel- red / green / blue, matching whichever channel the mask you want was written into.level- 1 through 128, matching the bit position it was written at.
Output is "Mask" (MASK).
The pair only makes sense together, and it's worth being explicit about why you'd want this over just keeping several plain MASK objects around: once you're past two or three regions - say a face mask, a hands mask, and a background mask all feeding different LoRAs or different inpainting passes in the same graph - separate MASK sockets get genuinely hard to track, and saving/loading them individually as image files means juggling a small pile of files that all need to travel together. One Multimask Image is one file. Read is the node that turns that one file back into something a normal mask-consuming node - an inpainting node, a conditioning-by-mask node - can actually use.
How to install it
ComfyUI Manager: search "NeoGriever," install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/NeoGriever/ComfyUI-NeoGriever
then restart. No dependencies to manage.
Common issues & troubleshooting
Wrong mask comes out. channel and level have to exactly match what you used on the corresponding Write call - there's no other bookkeeping anywhere; the bit position is the entire address. If you're pulling masks in a different order than you wrote them, or reusing a Write chain across a few workflows, keep a note (node titles work fine) of which mask lives at which channel+level.
Reading a normal image instead of a Multimask Image. Nothing stops you from pointing this at an ordinary photo - it'll "work" in the sense that it won't error, but the resulting mask is just noise from that channel's low bit, since a regular image was never packed by Write in the first place. This node has no way to detect that the input wasn't built by its own sibling.
Results look inverted or offset. Double-check you're reading the same level you wrote, not an adjacent one (4 instead of 8, say) - an off-by-one on the bit position will pull a completely different mask, not a shifted version of the right one.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| channel | COMBO | red | 3 options: red, green, blue |
| level | COMBO | 1 | 8 options: 1, 2, 4, 8, 16, 32, +2 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Mask | MASK | — |