Generator node

Color Analysis

Extracts an image's palette as live data: K base colors with subtones each, clustered perceptually (Oklab) on an analysis grid -- with stable color identity across frames for live video. A Mask input limits the ANALYSIS AREA (a segmentation mask in = the palette of the person only). The Colors structure carries, per color: the base color, its subtones, coverage, the region's center and its largest blob's outline as points. Palette/Centers/Coverages ride along as flat arrays. The Image output repaints the source in its own extracted palette (quantized, base-only, or label view); per-color region MASKS come from the companion Color Mask node.

Inputs

PortTypeDefault
ImageThe picture whose palette gets extracted. Cable any generator, camera or video node.image—
MaskOptional image that limits the ANALYSIS AREA — bright areas are counted, dark ones ignored. Feed a segmentation mask and you get the palette of just that person.image—
Mask ModeWhich channel of the mask image is read: Alpha, Red, Green, Blue or Luma. Only shown when a mask is connected.int0
Mask InvertSwaps the mask, so the analysis reads everything the mask was hiding.boolfalse
EnableOff stops the clustering, drops the palette and clears the output image.booltrue
ColorsHow many base colours the picture is clustered into. Clamped to 2…16; more colours mean a finer palette but a slower analysis.int8
SubtonesHow many shades each base colour reports — the lights and darks inside one colour family. Clamped to 1…8.int3
ResolutionLongest side, in cells, of the grid the picture is sampled on. Clamped to 16…256; higher catches small colour patches, lower is cheaper and steadier.int96
SmoothingHow much the palette eases toward its new values instead of jumping, keeping live video calm. Clamped to 0…0.95.float0.5
Update RateMilliseconds between analyses. Clamped to 16…2000; the picture keeps repainting every frame, only the palette refresh follows this cadence.float100
DisplayWhat the Image output shows: the source repainted in the full palette, in base colours only, or as flat label patches. Values outside the list snap to the nearest.int0

Outputs

PortType
ImageThe picture whose palette gets extracted. Cable any generator, camera or video node.image
ColorsHow many base colours the picture is clustered into. Clamped to 2…16; more colours mean a finer palette but a slower analysis.structure
Palettecolor
Centersstructure
Coveragesfloat
Countint
Widthfloat
Heightfloat

How It Works

Color Analysis extracts an image's palette as live data. It clusters the picture perceptually (k-means in the Oklab colour space) on a sized analysis grid, producing K base colours with S subtones each. The clustering is warm-started from the previous frame, so a colour keeps its INDEX across frames — the palette does not flicker on live video — and Smoothing makes it breathe rather than snap.

The work runs on the GPU and off the render thread, with an Update Rate and a mailbox that delivers results even when the main thread is busy.

Outputs

  • Colors — the structure that carries, per group: the base colour, its subtones, coverage, region centre, and the largest blob's outline as points. Points Visualize, Lines Visualize and Plexus read this structure directly — one group per colour, webs that never cross colours.
  • Palette / Centers / Coverages — flat arrays for driving anything else.
  • Image — the source repainted in its own palette: Quantized, Base Colors, or Labels.

Use Cases

  • Palette-driven visuals — colour a whole patch from the live camera's own palette.
  • Per-colour decomposition — feed Colors into Lines Visualize for one web per colour group, or into Color Mask / Color Blob for the regions.
  • Colour as music — Points to Notes can map hue onto the circle of fifths.

Tips

  • Keep K small (4–8) for stable, readable palettes; more clusters means more index churn on noisy video.
  • The Mask input limits analysis to a region — a segmentation mask gives you a person's palette, not the room's.
  • Coverage tells you how much of the frame a colour owns; use it to ignore minor groups.

Open Color Analysis in the interactive catalog →

Color Analysis is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More Generator nodes