# Dominant color extraction

## Overview <a href="#overview" id="overview"></a>

The model analyzes the colors present in the input image and determines if they fall into several predefined ranges. It then compares the number of pixels in those ranges and outputs color names that were detected as visually dominant.

The pixels of the image are examined to identify the most prominent colors present. Multiple factors such as the distribution and frequency of different color values are taken into account to determine the dominant colors.

To find the color of a pixel, all values in the image are converted to an alternative color representation that is designed to be more closely aligned with the way human vision perceives colors. This enures high-quality results.

## Use cases <a href="#typical-use-cases" id="typical-use-cases"></a>

Some typical use cases for this model include:

* **Visual search and filtering** - Users can search for images based on specific dominant color criteria. For example, they can search for images dominated by a particular color to find assets that align with a specific theme or aesthetic.
* **Color-based categorization** - The feature facilitates the automatic categorization of images based on their dominant colors.  This allows for easier location and grouping of images with similar color schemes.
* **Branding Enhancement** - Teams can utilize the dominant color information to ensure consistent branding and visual coherence. They can search for images that match their brand identity and integrate them into their campaigns.

## API endpoints

An up-to-date reference with all API endpoints is available here:

{% embed url="<https://developers.scaleflex.com/#b1898794-1392-45b3-8de3-bbac8c0864f9>" %}

## Example API responses

<table data-full-width="true"><thead><tr><th>Product image</th><th>API response</th><th data-hidden></th><th data-hidden></th><th data-hidden data-type="files"></th><th data-hidden data-type="rating" data-max="5"></th></tr></thead><tbody><tr><td><img src="/files/2Vsevtkk6TZkBqAJUtp5" alt="" data-size="original"></td><td><pre class="language-json"><code class="lang-json">{
    "status": "success",
    "version": "2.9.3",
    "sha1": "f87f1c2e708b1111aa8aa99640efec02aaeb130b",
    "request_uuid": "0e00fce5-19a5-4411-b161-6894f9a7ff8e",
    "file_downloaded": "grahame-jenkins-p7tai9P7H-s-unsplash.jpg",
    "dominant_colors": [
        {
            "color": "azure",
            "hex": "0980fb",
            "pixels": 402721,
            "ratio": 0.16,
            "all": 2453760
        }
    ],
    "main_colors": [
        "azure"
    ],
    "main_colors_ratio": [
        0.16
    ],
    "main_colors_pixels": [
        402721
    ],
    "main_colors_hex": [
        "0980fb"
    ]
}
</code></pre></td><td></td><td><img src="/files/ho7Amt04hvMa9bAxOWo9" alt=""></td><td></td><td>null</td></tr><tr><td><img src="/files/5Oo2q56DrwMUqnG1z3dt" alt="" data-size="original"></td><td><pre class="language-json"><code class="lang-json">{
    "status": "success",
    "version": "2.9.3",
    "sha1": "cb29b29a902db664cb3bcb83a593d5dc7e0ae06f",
    "request_uuid": "e7ca3fd3-5561-4b48-adf3-4df8120e48c3",
    "file_downloaded": "420799-MF-MELON_RED.jpg",
    "dominant_colors": [
        {
            "color": "pink",
            "hex": "ee6893",
            "pixels": 293000,
            "ratio": 0.05,
            "all": 6220800
        }
    ],
    "main_colors": [
        "pink"
    ],
    "main_colors_ratio": [
        0.05
    ],
    "main_colors_pixels": [
        293000
    ],
    "main_colors_hex": [
        "ee6893"
    ]
}
</code></pre></td><td></td><td></td><td></td><td>null</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scaleflex.com/visual-ai/visual-ai/images/classification-models/dominant-color-extraction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
