Return the most common colors from an image.
Downloads an image (or accepts an upload), samples it, and returns the top N colors with percentages. Drop this helper wherever you want to return the most common colors from an image with a single HTTP call. Send the documented inputs and the API streams back polished results you can hand directly to your users.
GETPOST
/media/color-palette-generator-from-imageVisual example


Sample request
GET https://api.dataczar.com/media/color-palette-generator-from-image?url=https://images.unsplash.com/photo-1498050108023-c5249f4df085?auto=format&fit=crop&w=960&q=80&count=5&ak=demoParameters
Query Parameters
| Name | Type | Description |
|---|---|---|
| url | string | HTTPS URL to the source image (omit when uploading). |
| count | integer | Number of colors to return (1-10). |
| dryrun | boolean | When true, skip download and return metadata only. |
All helper calls accept your Dataczar key via the ak query parameter. Need one? Create or copy a key on Dataczar Connect and drop it into each request.
Responses
Status 200
Palette generated.
{
"ok": true,
"data": {
"palette": [
{
"color": "#ff0000",
"percentage": 42.5
}
]
},
"meta": {
"dryrun": false
}
}Examples
Request
"GET /img/color-palette-generator-from-image?url=https://example.com/cat.jpg&count=4"Response
{
"ok": true,
"data": {
"palette": [
{
"color": "#fed136",
"percentage": 55.2
}
]
},
"meta": {
"dryrun": false
}
}Grab your Dataczar API key
Every helper runs with the same simple API key. Sign in (or create a free Dataczar account) at Dataczar Connect to issue keys in seconds, then drop the key into any `ak=` parameter and start shipping.
Tip: reuse the same key across these helpers, or rotate keys per project from the Connect dashboard.