GET get_image_colors¶
Given a list of collection image file paths, retrieve the associated colors from the index.
For each color, a similarity rank, a weight factor and a color class are returned along with the RGB values. The rank represents the position of the color in the sorted list, starting with 1. The weight specifies the importance of a color relative to all other colors in the list. For example, if several colors are extracted from a single image, a weight of 35.0 means that the associated color covers 35.0% of the image, and all the other colors together cover 65.0% of the image. The weights will sum up to 100. Each color is associated with one or more of the following main color classes: white, black, grey-light, grey, grey-dark, red-light, red, red-dark, pink-light, pink, pink-dark, orange-light, orange, orange-dark, green-light, green, green-dark, yellow-light, yellow, yellow-dark, blue-light, blue, blue-dark, violet-light, violet, violet-dark, brown-light, brown and brown-dark.
The sort order keeps similar colors together, mostly based on their hue, e.g. black, red, yellow, green, blue, white. Colors that are very close to each other are merged. Keep in mind that colors that are close in hue may vary greatly in brightness and saturation (e.g. dark reds may look grey or faint blues may look white). Hence, the sort order is subjective; it varies depending on factors such as the person, the monitor model, and the lighting conditions.
Resource URL¶
https://multicolorengine.tineye.com/<company>/rest/get_image_colors/
Parameters¶
In addition to the Common parameters there are:
Filepath¶
Key |
Description |
---|---|
filepath |
Colors will be returned for this filepath. |
color_format (optional) |
Return RGB or hex formatted colors, can be either rgb or hex, defaults to rgb. |
Filepaths¶
Key |
Description |
---|---|
filepaths[0] |
Colors will be returned for this filepath. |
… |
… |
filepaths[n] (optional) |
Colors will be returned for this filepath. |
color_format (optional) |
Return RGB or hex formatted colors, can be either rgb or hex, defaults to rgb. |
Request example¶
curl https://multicolorengine.tineye.com/<company>/rest/get_image_colors/ --get \
-d "filepath=path/folder/1.jpg" \
-d "color_format=hex"
or
curl https://multicolorengine.tineye.com/<company>/rest/get_image_colors/ --get \
-d "filepaths[0]=path/folder/1.jpg" \
-d "filepaths[1]=path/folder/2.jpg" \
-d "color_format=rgb"
Response examples¶
JSON (RGB, 2 colors shown)¶
{
"method": "get_image_colors",
"status": "ok",
"error": [],
"result": [
"filepath": "path/folder/1.jpg",
"colors": [
{
"color": [
194,
66,
28
],
"rank": 1,
"class": "orange-dark,red",
"weight": 76.37
},
{
"color": [
141,
125,
83
],
"rank": 2,
"class": "brown-light",
"weight": 23.63
}
]
],
"stats": {
"time_get": 5.04,
"time_total": 5.56
}
}
JSON (Hex, 2 colors shown)¶
{
"method": "get_image_colors",
"status": "ok",
"error": [],
"result": [
"filepath": "path/folder/1.jpg",
"colors": [
{
"color": "262321",
"rank": 1,
"class": "black",
"weight": 50.46
},
{
"color": "484821",
"rank": 2,
"class": "brown,green-dark",
"weight": 49.54
}
}
],
"stats": {
"time_get": 4.61,
"time_total": 5.15
}
}
XML (RGB, 2 colors shown)¶
<?xml version="1.0" encoding="utf-8"?>
<data>
<method>get_image_colors</method>
<status>ok</status>
<error/>
<result>
<item>
<filepath>path/folder/1.jpg</filepath>
<colors>
<item>
<color>
<item>194</item>
<item>66</item>
<item>28</item>
</color>
<rank>1</rank>
<class>orange-dark,red</class>
<weight>76.37</weight>
</item>
<item>
<color>
<item>141</item>
<item>125</item>
<item>83</item>
</color>
<rank>2</rank>
<class>brown-light</class>
<weight>23.63</weight>
</item>
</colors>
</item>
</result>
<stats>
<time_get>5.04</time_get>
<time_total>5.56</time_total>
</stats>
</data>
XML (Hex, 2 colors shown)¶
<?xml version="1.0" encoding="utf-8"?>
<data>
<method>get_image_colors</method>
<status>ok</status>
<error/>
<result>
<item>
<filepath>path/folder/1.jpg</filepath>
<colors>
<item>
<color>262321</color>
<rank>1</rank>
<class>black</class>
<weight>50.46</weight>
</item>
<item>
<color>484821</color>
<rank>2</rank>
<class>brown,green-dark</class>
<weight>49.54</weight>
</item>
</colors>
</item>
</result>
<stats>
<time_get>4.61</time_get>
<time_total>5.15</time_total>
</stats>
</data>