Nodes/Dream Painter/∨ Bitmap OR
ComfyUI Node

∨ Bitmap OR

OR merges two bitmaps into one region

By alt-key-projectΒ·Created 2 years agoΒ·Updated 2 years agoΒ· 2
∨ Bitmap OR
  • BITMAP
  • BITMAP2
  • BITMAP

Bitmap OR is the union operator of the Dream Painter pack. Give it two bitmaps and it returns one where a pixel is white if either input had a white pixel there - the combined footprint of both shapes. Where AND narrows and XOR isolates, OR is the "put them together" move: two separate guides become one region the model should treat as a single area.

You'll reach for it whenever you've built geometry in pieces and want to present it as one. Say you generated a star and a ring as separate shapes, rendered each to a bitmap, and now want a single guide that covers both. Feed them into OR and you get one bitmap with both - exactly what you'd then convert and push into a ControlNet. It's also the natural counterpart to the Shape Combiner node: that combines shapes before rendering; this combines pixels after.

How it works

A pixel-wise logical_or over two one-bit images (Pillow ImageChops.logical_or). White where either input is white, black only where both are black. Nothing learned, nothing downloaded - it's boolean algebra at the pixel level, and it runs in milliseconds on any size bitmap.

Two behaviors worth knowing:

  • The inputs don't have to match in size; Pillow's logical ops crop to the smaller image, so the output takes the smaller bitmap's dimensions.
  • Because OR can't create gray - a one-bit image has no in-between - the result is always a crisp union with no soft edges. If you want antialiased masks you'd convert to IMAGE/MASK first, or blur downstream.

Inputs and outputs

  • BITMAP - the first bitmap.
  • BITMAP2 - the second bitmap.

Output:

  • BITMAP - the union.

Same type in, same type out, which means OR nodes chain: merge three or four bitmaps by stacking them. Then route the result through Bitmap To Image & Mask to get something a ControlNet or inpaint node can actually consume.

Installing

From the Dream Painter pack (comfyui-dream-painter, alt-key-project). ComfyUI Manager β†’ Install Custom Nodes β†’ search Dream Painter β†’ install β†’ restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-painter
cd comfyui-dream-painter
pip install -r requirements.txt

No models, no downloads - pure pixel math.

Common issues

If your union comes out smaller than you expected, check whether one input is smaller than the other - OR crops to the smaller, it doesn't resize. That catches people when they merge a 512Β² grid with a 256Β² shape and suddenly everything is 256Β². If you need both at full size, resize the smaller bitmap first with Bitmap Resize. Also worth remembering: OR can't distinguish "partially white" - one stray white pixel in a noisy source will happily spread its region into the union, so clean your bitmaps (or threshold them via Image To Bitmap) before merging.

CategoryπŸ–Œ DPaint/β–© bitmap

Inputs (2)

NameTypeDefaultDescription
BITMAPBITMAPβ€”
BITMAP2BITMAPβ€”

Outputs (1)

NameTypeDescription
BITMAPBITMAPβ€”