Nodes/Dream Painter/πŸ™Ύ Bitmap To Image & Mask
ComfyUI Node

πŸ™Ύ Bitmap To Image & Mask

Turn a bitmap into an image and mask the rest of ComfyUI can use

By alt-key-projectΒ·Created 2 years agoΒ·Updated 2 years agoΒ· 2
πŸ™Ύ Bitmap To Image & Mask
  • BITMAP
  • IMAGE
  • MASK
β—„color_0_hex000000β–Ί
β—„color_1_hexffffffβ–Ί

This is the node that makes Dream Painter useful. Everything upstream - the shape generators, the boolean ops, the edge detection - produces BITMAPs, and a BITMAP is a private type only other DPaint nodes understand. Bitmap To Image & Mask is the exit door: it takes that one-bit bitmap and hands you a normal ComfyUI IMAGE plus a MASK, the two things the rest of your graph actually speaks.

That's why it appears in every example workflow the pack ships (checkerboard, rays_of_color, butterfly). It's the bridge between Dream Painter's private geometry world and the public one where ControlNet loaders, samplers, and inpaint masks live. If you're wondering "okay, now how do I actually use any of this," this node is the answer.

How it works

The bitmap's black pixels become one color, its white pixels another - and both colors are yours to pick as hex strings. Defaults are color_0_hex = 000000 (black) and color_1_hex = ffffff (white), but you can map the two states to any two colors, which is handy when you want the guide to read as dark lines on a light background or vice versa.

The node builds an RGBA image from those two colors, then derives the MASK from the alpha channel (inverted to follow ComfyUI's mask convention where white = the region of interest). The result: the same geometry, packaged twice - once as a picture you can feed a ControlNet, once as a mask you can feed an inpaint or detailer. For a deeper read on how masks feed the wider pipeline, the KB's masking and inpainting docs cover what happens after.

Inputs and outputs

  • BITMAP - the bitmap to convert.
  • color_0_hex - hex color for black pixels (default 000000).
  • color_1_hex - hex color for white pixels (default ffffff).

Outputs:

  • IMAGE - the RGB version, ready for ControlNet preprocessors.
  • MASK - the mask version, ready for inpaint/detailer inputs.

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.

Common issues

Two things trip people up. First, the mask polarity: if your inpaint target comes out inverted (painting the background instead of the shape), flip the mask - Bitmap Invert upstream does that cleanly. Second, remember the bitmap is two discrete states, so the IMAGE is flat and hard-edged by design; if you want softer edges, blur the image/mask after this node. And when a ControlNet ignores your guide entirely, check the color mapping - a white-on-black guide and a ControlNet expecting dark-on-light will quietly produce nothing.

CategoryπŸ–Œ DPaint/πŸ›  convert

Inputs (3)

NameTypeDefaultDescription
BITMAPBITMAPβ€”
color_0_hexSTRING000000β€”
color_1_hexSTRINGffffffβ€”

Outputs (2)

NameTypeDescription
IMAGEIMAGEβ€”
MASKMASKβ€”