CineChroma Devlog 01

April 8, 2026 Avinash Aldhapati
TechnicalPythonFilm
What CineChroma does, why I built it, and one concrete thing I learned about color clustering and frame sampling along the way.

The Problem

I watch a lot of films. At some point I became interested not just in the story but in the visual grammar — the color palettes directors and DPs commit to across an entire runtime. Films like Drive, Her, and Blade Runner 2049 have color identities you can feel before you consciously register them.

I wanted to be able to extract and visualize that color identity automatically, for any video file, without manually sampling frames or eyeballing screenshots. That's why I built CineChroma.

The goal was simple on paper: given a video, output its dominant color palette. In practice, a few decisions made all the difference.

How It Works

The pipeline has three stages:

  1. Frame extraction — FFmpeg samples one frame every N seconds. For a two-hour film at one frame per 10 seconds, that's ~720 frames.
  2. Color clustering — Each frame is resized to a thumbnail and flattened into RGB pixels. All pixels are fed into k-means, clustering into k dominant colors.
  3. Output — The cluster centroids become the palette. Currently rendered as a PNG swatch and printed as hex codes.

The Interesting Part

The thing I didn't expect: frame sampling strategy matters more than k-means tuning.

Early on I sampled uniformly — one frame every N seconds, evenly spaced. The palettes came out dominated by whatever the film spent the most runtime on: long dialogue scenes, neutral rooms, a single location.

A better approach was to also sample around high-motion frames — moments where the image changes significantly from the previous frame, which often correspond to cuts, action, and cinematographically intentional moments. The palettes became noticeably richer.

It's a small thing, but it shifted my thinking: the algorithm was never the bottleneck. The data selection was.

What's Next

Two things I want to build next:

  • Multi-film comparison — run CineChroma on several films and compare their palettes side by side.
  • HTML report generation — a self-contained HTML file with palette swatches, hex codes, and sample frames.