π¨ Sample Image as Palette
Steal an image's color identity in one step
- image
- palette
Every animation has a color problem: frame one looks gorgeous, frame forty has drifted into a different world. Sample Image as Palette [Dream] is the pack's answer to the capture half of that problem. Feed it an image and it randomly samples pixels to build an RGB_PALETTE - a compact description of that image's color identity that every other palette node in the pack can consume. Take your favorite first frame, sample it, and you've got a reference palette to keep the whole animation honest.
Mechanically it's refreshingly simple: the node draws samples random pixels (whole image, uniform distribution, seeded) and collects them into a palette. There's no clustering, no quantization, no dominant-color extraction - it's literally "grab N pixels, here's your palette." That sounds crude, but for the pack's purposes it's exactly right: the downstream noise and color-shift nodes work on the raw color distribution, so you want faithful samples, not a tidy six-color swatch.
The inputs that matter
- image - any ComfyUI IMAGE. One image in, one palette out (a batch yields one palette per image).
- samples - how many pixels to grab, 1 to 4096. Default 1024 is a good middle ground: plenty of color data, fast. More samples = more faithful, slower; fewer = lighter and more variable.
- seed - which pixels get picked. Same image + same seed = same palette, which you'll want for reproducibility in an animation.
Output is a single palette (RGB_PALETTE), ready to feed Noise from Palette, Palette Color Align, Palette Color Shift, or Compare Palettes.
Installing it
Part of 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. The numpy<2.0 pin is the usual install quirk.
Common issues
Because there's no clustering, small samples values give you a palette that varies a lot between seeds - if your colors feel unstable, raise the sample count rather than fighting the seed. And remember a palette is a distribution, not a representative swatch: a mostly-gray image will give you mostly-gray samples, which is accurate but not what people expect when they want "the vibe." If you only care about one part of an image (the sky, not the foreground), the area variant - Sample Image Area as Palette - is what you actually want. Pack-wide note: unmaintained per its README, but this sampler runs fine on current ComfyUI.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| samples | INT | 10241β4096 | β |
| seed | INT | 00β18446744073709550000 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| palette | RGB_PALETTE | β |