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

πŸ™Ύ Image To Bitmap

Quantize any image down to pure black and white

By alt-key-projectΒ·Created 2 years agoΒ·Updated 2 years agoΒ· 2
πŸ™Ύ Image To Bitmap
  • IMAGE
  • BITMAP
β—„threshold0.50β–Ί

Dream Painter's private language is one-bit bitmaps, but the world is full of normal images. Image To Bitmap is the door in the other direction from Bitmap To Image & Mask: it takes any regular ComfyUI IMAGE and squeezes it down to pure black and white, using a threshold. That's how you pull a real sketch, a logo, or a render into the bitmap pipeline so the rest of the pack's tools can chew on it.

Why would you want a quantized version of an image? A few genuinely useful reasons. You have a hand-drawn sketch you want to turn into a crisp ControlNet line guide - threshold it and it becomes a clean high-contrast map. You want to reuse geometry you already generated somewhere: render it once, threshold it, and suddenly it can live alongside the pack's own shapes in the same boolean graph. Or you just want a harsh graphic-style reduction for a poster look. Thresholding is a one-way street - all nuance gone, two values left - but that's the point.

How it works

The image is converted to grayscale, then every pixel is compared against the threshold: brighter than the threshold becomes white, darker becomes black. The threshold input runs 0 to 1 (default 0.5), so 0.5 means "everything above middle gray is white." Lower the threshold and more of the image survives as white; raise it and more collapses to black. The output is a one-bit bitmap, same size as the input's first frame.

One implementation detail: if you feed it a batch of images, it only uses the first frame - this is a single-image conversion, not a batch operation.

Inputs and outputs

  • IMAGE - any ComfyUI image tensor.
  • threshold - 0.0–1.0, the brightness cutoff (default 0.5).

Output:

  • BITMAP - the thresholded one-bit bitmap.

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

Threshold is the whole game, and a wrong one produces either a wall of black or a wall of white. Start at 0.5 and nudge in small steps - the widget steps by 0.05 for a reason. Noisy sources are the other trap: a JPEG artifact-heavy image thresholds into speckled garbage, so if your bitmap looks like static, clean or sharpen the image first (or blur it) before thresholding. And remember the output is one-bit with hard edges - this is the harsh reduction, not a soft matte. If you need softness, apply it after converting back to an image/mask.

CategoryπŸ–Œ DPaint/πŸ›  convert

Inputs (2)

NameTypeDefaultDescription
IMAGEIMAGEβ€”
thresholdFLOAT0.500–1β€”

Outputs (1)

NameTypeDescription
BITMAPBITMAPβ€”