π¨ Sample Image Area as Palette
Grab the sky, not the ground
- image
- palette
Sample Image as Palette is great until you realize you don't want the whole image - you want the colors of the sky, or just the grass, or only that neon sign. Sample Image Area as Palette [Dream] is the surgical version. It splits your image into a 3Γ3 grid and randomly samples pixels from exactly one cell of it - top-left, top-center, all the way to bottom-right - producing a palette that represents one region, not the whole frame. It's the node that makes the pack's area-sampled-noise workflow possible: sample the sky region of your reference frame into a palette, sample the ground region into another, and drive region-specific noise or color from each.
The mechanism is the same honest random-sampling as its sibling - no clustering, just samples random pixels from within the chosen rectangle - with one structural difference: the image is divided into nine equal rectangles and you pick which one gets sampled. Default samples is 256, a quarter of the whole-image node's default, which is sensible because you're drawing from a smaller area. Seeded, so the same image, area, and seed always give you the same palette.
The inputs that matter
- image - any ComfyUI IMAGE.
- area - one of nine positions:
top-left,top-center,top-right,center-left,center,center-right,bottom-left,bottom-center,bottom-right. This is the whole point of the node. - samples - 1 to 4096, default 256. Fewer = lighter and more seed-sensitive; more = more faithful to the region.
- seed - reproducibility.
Output is a single palette (RGB_PALETTE). Wire it into Noise from Area Palettes (slot it into the matching region input), Noise from Palette, or Palette Color Align.
Installing it
Ships with Dream Project Animation Nodes - ComfyUI Manager (search "Dream Project Animation Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-project.git
cd comfyui-dream-project
pip install -r requirements.txt
Restart ComfyUI. Watch the numpy<2.0 pin if pip touches your environment.
Common issues
The main trap is forgetting the grid is exactly three by three with equal cells - you can't nudge the region, only pick the cell. If your sky bleeds into the top-center cell boundary, sample both top cells and let area blending sort it out. Also, one palette per batch image: if your input is a batch of frames, you get a palette per frame, which is powerful but means your palette count grows with the batch. And the pack-wide honesty note: the README declares the pack unmaintained, but this sampler is stable and runs fine on current ComfyUI.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| samples | INT | 2561β4096 | β |
| seed | INT | 00β18446744073709550000 | β |
| area | COMBO | 9 options: top-left, top-center, top-right, center-left, center, center-right, +3 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| palette | RGB_PALETTE | β |