Free plan

Color Palette

Find the main colours in a picture
POST
/v1/images/palette

About this tool

Finds the most used colours in a picture and lists them. For each colour you see its share of the picture, its colour code (like #FF5733), the nearest colour name, and a text colour that is easy to read on it. You can choose how many colours to find, skip white or black, and get a strip of colour squares.
For example, you pick a colour scheme for a poster from a photo you like.

How to use it

  1. Choose this tool.
  2. Add your picture with Upload or drag and drop.
  3. Choose how many colours you want.
  4. Turn on the colour strip if you want it, then press Generate.
  5. Read or copy the colour codes.

What you get back

You get a list of the main colours with their codes on screen, and optionally a strip picture you can download.
GOOD TO KNOW
Works on a small copy of the picture, so it is fast on any size. Transparent pixels are ignored. One picture counts as one image.
TEST IT LIVE

Try Color Palette in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Images
Plan
Free
Method
POST
Endpoint
/v1/images/palette
Tool ID
images.palette
Authentication
API key
Accepts
JPEG, PNG, WEBP, GIF, AVIF, TIFF +15 more
Background jobs
Yes
Usage group
Image
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/images/palette" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'images=@photo.jpg' \
  -F 'colors=6' \
  -F 'swatch=false' \
  -F 'ignore_white=false'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.images.palette({
    "images": 'photo.jpg',
    "colors": 6,
    "swatch": false,
    "ignore_white": false
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->images()->palette([
    'images' => 'photo.jpg',
    'colors' => 6,
    'swatch' => false,
    'ignore_white' => false,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Find the main colours of a picture: each with its share of the picture, hex, RGB and HSL values, the nearest colour name and a text colour that reads on it. Optionally a PNG strip of the swatches.

Color Palette accepts JPEG, PNG, WEBP, GIF, AVIF, TIFF, SVG, SVGZ, BMP, ICO, APNG, PNM and 9 more. You can send several files in one request.

Color Palette is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/images/palette with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.