apyhub
IMAGE PROCESSING

Extract Image Color Palette API

What it does

Image Palette Extractor reads an image file and returns the dominant colour along with a palette of up to 20 colours. Send an image in file, and optionally set colors to control how many palette entries you want back.

The response includes dominant as a hex colour for the most dominant pixel cluster, palette as hex colours sorted by dominance, and rgb_palette as the same colours broken out into r, g, and b values. That makes it easy to plug the output into design systems, theme builders, image analysis workflows, or UI previews that need colours in both CSS-friendly and RGB formats.

Use Image Palette Extractor when you need to derive a brand palette from an uploaded asset, generate accent colours for a product card, or inspect an image before applying a matching background or border colour. The only required input is the image itself, so it fits cleanly into upload flows and asset-processing pipelines.

POST
Extract dominant colour and palette from an image
https://api.eu.apyhub.com/dosvak/extract-image-palette

QUICKSTART

GUIDE

Quickstart

Upload an image to extract its color palette.

curl -X POST "https://api.eu.apyhub.com/dosvak/extract-image-palette" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/image.jpg"

What you'll get back

Returns a JSON object with three top-level fields: palette is an array of HEX color strings sorted by dominance, dominant is the HEX color of the most dominant pixel cluster, and rgb_palette is an array of RGB objects with r, g, and b integer values.

{
  "palette": ["#1f2937", "#f59e0b", "#e5e7eb"],
  "dominant": "#1f2937",
  "rgb_palette": [
    { "r": 31, "g": 41, "b": 55 },
    { "r": 245, "g": 158, "b": 11 },
    { "r": 229, "g": 231, "b": 235 }
  ]
}
TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*

About this endpoint

What it does

Extracts a colour palette from an uploaded image and returns the dominant colour plus the palette colors derived from that image. The number of colours to extract can be controlled with the colors request body field.

Request Body

ParameterTypeMandatoryDescription
fileStringNoImage file to analyze. Binary upload (format: binary).
colorsIntegerNoNumber of colours to extract. Default: 5. Minimum: 1. Maximum: 20.

Response

Returns a JSON object with palette, dominant, and rgb_palette fields. palette and rgb_palette are arrays, while dominant is a string containing the dominant HEX colour.

ParameterTypeMandatoryDescription
paletteString ArrayNoHEX colours sorted by dominance.
dominantStringNoHEX colour of the most dominant pixel cluster.
rgb_paletteObject ArrayNoArray of RGB colour objects. Each object contains r, g, and b integer fields.

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.