β Draw Shape As Bitmap
Turn a vector shape into pixels you can actually use
- SHAPE
- BITMAP
Here's where the geometry becomes real. Dream Painter splits its world into two halves: SHAPE objects, which are pure vector data floating in a normalized 0β1 coordinate space, and BITMAPs, which are actual pixels. Draw Shape As Bitmap is the node that crosses that line - it rasterizes a shape onto a canvas and hands you a one-bit bitmap, ready for the converters that push it into the rest of ComfyUI.
If you're following the pack's standard flow, this node sits right after your shape generation and before Bitmap To Image & Mask: shape β Draw Shape As Bitmap β Bitmap To Image & Mask β ControlNet or mask. It's the step every example workflow in the repo runs, because without it a shape is just an invisible bundle of coordinates.
How it works
The shape lives in a normalized viewport - by default the region from (0,0) to (1,1), controlled by the four shape_bound_* inputs. The node scales that viewport onto your canvas (bitmap_width Γ bitmap_height, default 512Γ512) and draws the shape's polygons with Pillow.
The parameters that matter:
- fill -
yesdraws solid filled polygons;nodraws just the outlines (stroke width fromline_width). - draw_mode -
normalpaints over the canvas;xortoggles pixels, so overlapping shapes cancel out. The xor mode is how the pack's checkerboard example builds a pattern where every other cell is the "not" of its neighbor. - bitmap_width / bitmap_height - the output resolution. Higher = crisper guide, but remember ControlNet likes powers of two in many setups.
- shape_bound_x_min / y_min / x_max / y_max - the viewport rectangle. Zoom into part of the shape's space by shrinking this box; widen it to fit more.
Inputs and outputs
- SHAPE, fill, draw_mode, shape_bound_x_min, shape_bound_y_min, shape_bound_x_max, shape_bound_y_max, bitmap_width, bitmap_height, line_width.
Output:
- BITMAP - the rendered 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
The most common surprise is the viewport: if your shape's coordinates don't fit the default (0,0)-(1,1) box, you'll render a blank or clipped bitmap. That's what Shape Center & Fit is for - normalize your shape into the 0β1 box before rendering and the default viewport just works. Second: rendering at low resolution then upscaling the bitmap gives chunky edges; render at the resolution you actually want. And if the drawing looks backwards polarity-wise, remember the pack paints white on black by default - flip with Bitmap Invert or recolor at the conversion step.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| SHAPE | SHAPE | β | |
| fill | COMBO | 2 options: yes, no | |
| draw_mode | COMBO | 2 options: normal, xor | |
| shape_bound_x_min | FLOAT | 0.00 | β |
| shape_bound_y_min | FLOAT | 0.00 | β |
| shape_bound_x_max | FLOAT | 1.00 | β |
| shape_bound_y_max | FLOAT | 1.00 | β |
| bitmap_width | INT | 512 | β |
| bitmap_height | INT | 512 | β |
| line_width | INT | 1 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BITMAP | BITMAP | β |