β§ Bitmap AND
Keep only where two bitmaps overlap
- BITMAP
- BITMAP2
- BITMAP
Somewhere in a Dream Painter graph you always end up with two things you want to combine: a grid of shapes, a rotated star, a mask from an image. Bitmap AND is the operation that answers "where are both of these white?" - the intersection. If you've ever stacked two masks in an image editor and wanted just the shared region, that's this node, wired into your graph instead of a brush.
It's part of the logical trio (AND / OR / XOR) that the pack's bitmap category revolves around. In a controlnet-guidance workflow these three are your boolean algebra: AND narrows a region, OR merges two regions, XOR isolates the difference. Where you'd reach for AND specifically: you generated a filled shape and a grid, and you want to condition only on the cells that overlap the shape. One AND node later, that's exactly your guide image.
How it works
Under the hood this is a pixel-wise logical_and over two one-bit images - the pack keeps bitmaps as PIL mode-"1" images, so "white" is 1 and "black" is 0. A pixel in the output is white only if both inputs have a white pixel in the same position, black otherwise. Nothing is trained, nothing is downloaded; it's the same boolean logic a min() over two binary arrays gives you, just wrapped in a node.
One thing worth knowing: the two inputs don't need to be the same size. PIL's logical ops handle mismatched dimensions by cropping to the smaller, so the output takes the size of the smaller bitmap. If you're combining a 512Γ512 grid with a 256Γ256 shape, the result comes out 256Γ256.
Inputs and outputs
Only two, and they're both the same type:
- BITMAP - the first bitmap.
- BITMAP2 - the second bitmap.
The output is a single BITMAP, still one-bit, which you'll almost always want to feed into Bitmap To Image & Mask before it can reach a ControlNet or an inpaint mask. In the pack's butterfly example, Bitmap AND is used to combine generated geometry with a mask so the final guide only has content where both agree - the classic setup.
Installing
This is one node in the Dream Painter pack (comfyui-dream-painter by alt-key-project). Easiest route: ComfyUI Manager β Install Custom Nodes β search Dream Painter β install β restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-painter
cd comfyui-dream-painter
pip install -r requirements.txt
Then restart ComfyUI. No model files, no API key, no GPU-loading step - the whole pack is pure pixel math on PIL.
Common issues
The pack pins numpy<2.0.0 in its requirements, so if your environment already has numpy 2.x, installing this can downgrade it - usually harmless, occasionally grumpy with other nodes that want the newer version. If you hit a numpy conflict after install, that's the culprit. Otherwise the only real "issue" is forgetting the conversion step: a BITMAP output will not plug into a ControlNet or mask input by itself. Route it through Bitmap To Image & Mask and you're set.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| BITMAP | BITMAP | β | |
| BITMAP2 | BITMAP | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BITMAP | BITMAP | β |