Nodes/Pixel Palette Art/Pixel Palette Extractor
ComfyUI Node

Pixel Palette Extractor

Pull the palette out of a finished image

By ranska·Created about a year ago·Updated 7 months ago· 1
Pixel Palette Extractor
  • image
  • palette_image
palette_width16
color_size32
show_indicesfalse
font_size10

Pixel Palette Extractor is the pack's reverse-engineering node. Give it an IMAGE and it extracts the unique colors, then renders them as a palette grid image - usually so you can study what a piece of art was built from. See a sprite or a game screenshot whose color scheme you love? Feed it through this node and you get the breakdown: every distinct color, laid out in a grid with optional index labels.

Now the honest caveat, because it matters: this node does not output a PIXEL_PALETTE. Its output is a rendered IMAGE of the palette. There's no wiring from this node into Sort Palette or Mix Palettes - it's an analysis tool, not a source for the rest of the pack. If you want to use the extracted colors downstream, you'd have to rebuild them by hand or load the original palette file another way. It's the one node in the pack that sits slightly apart from the object-based pipeline, and knowing that going in saves you a confusing five minutes.

How it works

The node converts the ComfyUI image to PIL, then reduces it to a palette in a three-tier fallback: first convert('P', colors=256), then quantize(), then a straight unique-pixel pass as a last resort. It reads the unique entries from the resulting palette and draws them into a grid where palette_width sets the colors per row and color_size the cell size. show_indices stamps the palette index on each cell (with font_size), which is handy when the palette came from an indexed GIF and you need to match index numbers. On failure it returns a red error image rather than crashing.

Inputs and outputs

Required:

  • image (IMAGE) - whatever you're analyzing.
  • palette_width (1–32, default 16) - colors per row.
  • color_size (8–128, default 32) - cell size in pixels.
  • show_indices (bool, default false).
  • font_size (6–24, default 10).

Output: palette_image, an IMAGE tensor. Display it with PreviewImage or save it.

Installing

Part of the Pixel Palette Art pack. ComfyUI Manager → "Pixel Palette Art", or:

cd ComfyUI/custom_nodes
git clone https://github.com/ranska/pixel_palette_art.git

Restart ComfyUI; it's under image/color. Pillow only - no downloads.

Common issues

The big one is the expectation mismatch: people wire the output into the pack's palette nodes and find the wire won't connect, because it's an IMAGE, not a PIXEL_PALETTE. It's a visualizer/analyzer, full stop.

Second: palette_width caps at 32 columns. An image with hundreds of unique colors (photographs, smooth gradients) produces a huge grid and the "palette" stops being useful - this node is built for pixel art and indexed images where the color count is naturally small. Run it on a low-palette sprite, not a photo, unless you enjoy scrolling. And note it only reads the first frame of a batch - if you feed a batch, you get the first image's palette.

Categoryimage/color

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
palette_widthINT161–32
color_sizeINT328–128
show_indicesBOOLEANfalse
font_sizeINT106–24

Outputs (1)

NameTypeDescription
palette_imageIMAGE