Color schemes detection
Computer Vision analyzes the colors in an image to provide three different attributes: the dominant foreground color, the dominant background color, and the larger set of dominant colors in the image. The set of possible returned colors is: black, blue, brown, gray, green, orange, pink, purple, red, teal, white, and yellow.
Computer Vision also extracts an accent color, which represents the most vibrant color in the image, based on a combination of the dominant color set and saturation. The accent color is returned as a hexadecimal HTML color code (for example, #00CC00
).
Computer Vision also returns a boolean value indicating whether the image is a black-and-white image.
Color scheme detection examples
The following example illustrates the JSON response returned by Computer Vision when it detects the color scheme of an image.
Note
In this case, the example image is not a black and white image, but the dominant foreground and background colors are black, and the dominant colors for the image as a whole are black and white.
{
"color": {
"dominantColorForeground": "Black",
"dominantColorBackground": "Black",
"dominantColors": ["Black", "White"],
"accentColor": "BB6D10",
"isBwImg": false
},
"requestId": "0dc394bf-db50-4871-bdcc-13707d9405ea",
"metadata": {
"height": 202,
"width": 300,
"format": "Jpeg"
}
}
Dominant color examples
The following table shows the returned foreground, background, and image colors for each sample image.
Image | Dominant colors |
---|---|
![]() |
Foreground: Black Background: White Colors: Black, White, Green |
![]() |
Foreground: Black Background: Black Colors: Black |
Accent color examples
The following table shows the returned accent color, as a hexadecimal HTML color value, for each example image.
Image | Accent color |
---|---|
![]() |
#BB6D10 |
![]() |
#C6A205 |
![]() |
#474A84 |
Black and white detection examples
The following table shows Computer Vision's black and white evaluation in the sample images.
Image | Black & white? |
---|---|
![]() |
true |
![]() |
false |
Use the API
The color scheme detection feature is part of the Analyze Image API. You can call this API through a native SDK or through REST calls. Include Color
in the visualFeatures query parameter. Then, when you get the full JSON response, simply parse the string for the contents of the "color"
section.
Feedback
Submit and view feedback for