ForHosting KIT · Images

Extract a color palette

A product photo, a hero banner or a user avatar all carry a small handful of colors that define how they read at a glance — this endpoint pulls that palette out as a ranked list of hex values you can act on. Feed it an image, get back the colors that actually matter, ordered by presence.

● StableFree · in your browser
Use it from WebAPIEmailApp soonTelegram soon

Runs in your browser. Free, unlimited — your data never leaves this page.

Why a handful of hex codes matters

A single image can contain millions of individual pixel values, but almost none of that granularity is useful to a design system, a recommendation engine or a UI that wants to adapt its accent color to whatever photo the user just uploaded. What's useful is a short, ranked list: the two or three colors a human would actually name if you asked them to describe the picture. That's the gap this endpoint closes — it does the color-quantization work so nothing downstream has to reinvent it.

How the extraction works

Send an image to POST /image/palette and the task clusters the image's colors, discards near-duplicates and noise, and returns a ranked set of representative swatches with their proportion of the image. The result is deterministic for a given image, so the same photo always yields the same palette, which matters if you're caching results or comparing images against each other downstream.

A short history of the problem

Palette extraction has been a staple of image processing since the earliest days of indexed-color displays, when engineers had to reduce a photo to 256 colors just to render it at all. The constraint that forced that work then — limited color depth — is gone, but the underlying technique turned out to be exactly what modern design tooling needs: not a way to compress an image, but a way to summarize what it looks like in a handful of numbers.

What to expect back

Because every task on this API runs asynchronously, you get a task_id right away and the palette itself arrives through a signed webhook or a signed link valid for 24 hours — no polling loop required if you wire up the webhook. Results are ordered by dominance, so the first swatch is genuinely the color that occupies the most of the image, not just the first one detected.

Where it plugs into automation

Content and e-commerce teams typically call this the moment an image is uploaded, feeding the palette straight into a theming engine, a product-card background, or a tagging system that groups items by color family — all without a human ever opening a color picker. At $0.002 per request with no charge on failure, it's cheap enough to run on every image in a catalog rather than a sampled subset.

Dynamic UI theming

Extract a hero image's palette and use the dominant swatch as the accent color for a product page or album view, computed automatically instead of hand-picked.

Color-based product search

Tag every catalog image with its dominant palette so shoppers can filter apparel or home goods by 'blue' or 'terracotta' without manual tagging.

Automated mood boards

Group uploaded reference images by shared palette to build cohesive design mood boards without a designer sorting swatches by eye.

Ad creative QA

Compare the extracted palette of a new ad creative against brand colors to flag off-brand submissions before they go live.

How many colors does the palette API return?

A ranked set of representative swatches ordered by how much of the image each one covers, from most to least dominant.

Is this color palette extraction API free?

The tool above runs free in your browser. The API is paid — each call draws from your prepaid ForHosting KIT balance: top up from $10.00 (it never expires), pay each request's published price, and a call with no balance returns HTTP 402. No subscription, no tokens, and a failed task is never charged.

Will the same image always return the same palette?

Yes, extraction is deterministic for a given image, which makes it safe to cache results or compare palettes across a catalog.

What's the difference between this and the dominant color endpoint?

This returns a ranked multi-color palette; the dominant-color endpoint returns just the single most representative color for cases where one value is all you need.

Can I extract palettes for a whole product catalog in bulk?

Yes, submit one request per image and each is queued and billed independently, so you can process an entire catalog without special batch handling.

How do I receive the extracted palette?

Through a signed webhook, recommended for automated pipelines, or a signed link valid for 24 hours.

Does the format returned use hex codes?

Yes, swatches are returned as hex color values ranked by dominance, ready to drop into CSS or a design token file.

What image formats can I send?

Standard raster formats such as JPEG and PNG are supported; the task decodes the image and clusters its colors regardless of source.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/image/palette

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/image/palette \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image":"https://ejemplo.com/imagen.jpg"}'
{
  "image": "https://ejemplo.com/imagen.jpg"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "image.palette",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb15
max_megapixels12
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →