Built to order

Color Palette Extractor from Images

This project is a color palette extractor that pulls the dominant colors out of any photo using real algorithms — median-cut quantization and k-means clustering — with an eyedropper loupe that samples exact pixels, per-color usage shares, harmony suggestions, and one-click export to ASE, CSS and PNG. The extraction genuinely runs on the image's pixels in the browser; the demo ships with real photographs so every feature is verifiable. It ships with the full app, algorithm source and the complete viva kit. Suitable for B.E./B.Tech final-year projects in Computer Science and IT.

Color Palette Extractor from Images — project thumbnail preview
More project photos (2)

The problem

Designers constantly ask 'what are the colors in this photo?' and most tools answer with a black box. This project builds a color palette extractor that shows its work: upload any image (or use the built-in real photographs) and the app extracts dominant colors with two genuine algorithms — median-cut quantization and k-means clustering — running on the actual pixels in the browser. An eyedropper with a magnifier loupe samples any exact pixel, each swatch shows its share of the image, and harmony tools suggest complementary, analogous and triadic companions. Palettes export to ASE (Adobe Swatch Exchange), CSS variables and PNG strip formats. Because both algorithms are implemented from scratch and their intermediate steps are visualizable, the report can explain quantization and clustering honestly — no black boxes anywhere.

How it works

  1. The user uploads an image or picks one of the built-in real photographs; it is drawn to an offscreen canvas for pixel access.
  2. Optional downsampling (default 200 px on the long edge) keeps extraction fast while preserving color statistics.
  3. Median-cut recursively splits the RGB color space at median boundaries until the requested color count is reached; each box's average becomes a swatch.
  4. K-means (k = color count, k-means++ seeding) clusters the sampled pixels; centroids become the palette, with iteration count shown.
  5. Pixels are assigned to their nearest swatch to compute each color's share of the image.
  6. The eyedropper reads raw pixel data under the cursor with a loupe magnifier for precise sampling.
  7. Export serializes the palette to ASE binary, CSS variables, or a rendered PNG strip for download.

Tech stack:

  • JavaScript (ES6+)
  • Canvas pixel processing
  • Median-cut quantization
  • K-means clustering
  • HSV color math
  • ASE/CSS/PNG exporters
  • Single-file web app
Parameter Value
Algorithms Median-cut + k-means (from scratch)
Palette size 3–10 colors, adjustable live
Eyedropper Loupe magnifier, exact hex readout
Exports ASE, CSS variables, PNG strip
Sampling Downsampled pixel statistics (configurable)
Harmonies Complementary, analogous, triadic
Runtime Sub-second on typical photos (design target)
Privacy All processing client-side; no uploads

Project features

  • [Two real extraction algorithms] Median-cut quantization and k-means clustering, both implemented from scratch and run on the image's real pixels.
  • [Eyedropper with loupe] Click any pixel to sample it exactly; the magnifier loupe shows a zoomed grid with the center pixel's hex value.
  • [Usage shares] Every swatch shows what percentage of the image it represents, computed from the actual pixel assignment.
  • [Harmony suggestions] Complementary, analogous and triadic companions generated from the dominant hues in HSV space.
  • [Palette export] One-click export to ASE, CSS custom properties, and PNG strip — formats designers actually use.
  • [Algorithm comparison view] Run median-cut and k-means side by side on the same image and compare their palettes and runtimes.
  • [Adjustable color count] Extract 3–10 dominant colors; the algorithms re-run live as the slider moves.

What is included

  • Single-file palette extractor app (working demo)
  • From-scratch median-cut and k-means source code
  • 4 built-in real photographs for testing
  • ASE, CSS and PNG palette exporters
  • Project report PDF (quantization theory, clustering, color spaces)
  • PPT presentation for final review
  • Viva Q&A preparation document

Limitations & prerequisites

  • Extraction quality depends on the image: near-monochrome photos yield near-monochrome palettes, which is correct behavior, not a bug.
  • K-means is randomized (k-means++ seeding); repeated runs may differ slightly — the UI notes this.
  • Very large images are downsampled before analysis; per-pixel-exact mode is available but slower.
  • ASE export targets the common swatch format; exotic color modes (LAB swatches) are not included.
  • Harmony suggestions are computed in HSV and are stylistic aids, not color-theory guarantees.
  • Runtime figures are design targets on the developer's laptop, not measured claims across devices.

Frequently Asked Questions

How do median-cut and k-means differ here?

Median-cut partitions the RGB color space by repeatedly splitting the most populous box at its median — fast and deterministic. K-means iteratively moves cluster centroids toward pixel groups — slower but often more perceptually pleasing. The app runs both so you can compare on the same image.

Does it upload my photos anywhere?

No. The image is drawn to a canvas and every pixel is processed locally in your browser. Nothing leaves your machine.

What export formats are supported?

ASE (opens in Photoshop/Illustrator), CSS custom properties for web projects, and a PNG strip image of the swatches.

Can I pick an exact color from the photo?

Yes — the eyedropper with a magnifier loupe samples the precise pixel under your cursor and shows its hex, RGB and HSV values.

Why do two runs sometimes give slightly different palettes?

K-means uses randomized k-means++ seeding, so centroids can settle differently. Median-cut is fully deterministic if you need repeatability.

Is this project suitable for a final-year project?

Yes — for Computer Science and IT programs. It covers image processing, quantization, clustering algorithms and color science with a polished, demonstrable tool. Suitable for B.E./B.Tech final-year projects in Computer Science and IT.

Components & software requirements
  • JavaScript (ES6+)
  • Canvas pixel processing
  • Median-cut quantization
  • K-means clustering
  • HSV color math
  • ASE/CSS/PNG exporters
  • Single-file web app
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Illustration of JWT authentication: a brass key handing a glowing sealed token to a server rack and a laptop login screen, linked by a chain motif.B.E./B.Tech Computer Science and IT students adding login and protected APIs to their final-year web projects

JWT Authentication for Students: Tokens, Signatures, Refresh Flows and a Node.js Implementation

How does JWT login actually work? When a user logs in, the server issues a signed token in three parts — header, payload, signature. The client sends it back as an Authorization: Bearer header, and the server verifies the signature instead of looking up a session. This guide decodes a real token by hand, walks through the full login and refresh flow, and builds a working Node.js implementation with bcrypt password hashing, token rotation, and storage rules that survive a viva.

Read guide
Illustration of SQL versus NoSQL: neat filing-cabinet table rows on one side against flexible nested document cards on the other, joined by dotted lines.B.E./B.Tech Computer Science and IT students choosing and designing the database for their final-year project

SQL vs NoSQL for Final-Year Projects: Which Database Should You Pick?

MySQL or MongoDB for your final-year project? SQL databases store data in related tables with enforced schemas, joins and transactions — the right default when your data is structured and money or records must stay consistent. NoSQL document stores trade the rigid schema for flexible, nested documents that ship faster when your data shape keeps changing. This guide compares them with a worked hospital-appointment example in both, a decision table, and rules matched to common project archetypes.

Read guide
Editorial illustration of shipping containers transforming into glowing software windows beside a laptop showing container layers, in blue and teal tones.B.E./B.Tech Computer Science and IT final-year students shipping web/backend projects

Docker for Student Projects: Images, Containers and Compose from Zero

End ‘it works on my machine’ failures: learn what Docker images and containers actually are, write lean Dockerfiles that exploit layer caching, persist data with volumes, orchestrate app-plus-database with Compose, and package an evaluator-proof submission — with the debugging table for every error you will definitely meet.

Read guide
Get a quotation