Image Color Extraction API Documentation

API Summery :

This service can be used to extract the main colors of an uploaded input image. This is helpful for image management and color query. This service supports automatic removal of relatively simple background thus to exclude the background colors.

Application scenarios:

stock image platforms, photo community sites, image sharing Apps



API end point : http://api1.wozhitu.com:8084/vsearchtech/imgPnpRest/extractcolor

Image Format Requirement: JPG format 300 – 1200 PIX

Request Method :POST

Request Parameters(body) :

Parameter Name Type Required Parameter Location Description Default Value
apikey string Yes header API Key None
fmt string No header Response format: json or xml json
numofcolor int No body How many sub-color to draw 5
bgrdrm int No body
1 - Remove background
0 – Do not remove the background
0 Do not remove the background

Parameter Name Type Required Parameter Location Description Default Value
photo file Yes body Image for uploading None


Detailed use of tutorials



API end point : http://api1.wozhitu.com:8084/vsearchtech/imgPnpRest/extractcolor

Image Format Requirement: JPG format 300 – 1200 PIX

Request Method : POST

Request Parameters(body) :

Parameter Name Type Required Parameter Location Description Default Value
apikey string Yes header API Key None
fmt string No header Response format: json or xml json
imgurl string Yes body Image URL None
numofcolor int No body How many sub-color to draw 5
bgrdrm int No body
1 - Remove background
0 – Do not remove the background
0 Do not remove the background


JSON Response Example :

[{"class":"vs.vscore.colorextract.ApiColorExtractResultEntry","clrName":"Olive|橄榄绿(ExactName:OliveDrab)","rgbHexString":"#798d2c","rgbString":"rgb(121,141,44)","weight":0.4548114},{"class":"vs.vscore.colorextract.ApiColorExtractResultEntry","clrName":"Silver|银(ExactName:Gainsboro)","rgbHexString":"#e3dcdb","rgbString":"rgb(227,220,219)","weight":0.30173904},{"class":"vs.vscore.colorextract.ApiColorExtractResultEntry","clrName":"Black|黑(ExactName:DarkSlateGray)","rgbHexString":"#303416","rgbString":"rgb(48,52,22)","weight":0.23812395},{"class":"vs.vscore.colorextract.ApiColorExtractResultEntry","clrName":"Silver|银(ExactName:Tan)","rgbHexString":"#c7b695","rgbString":"rgb(199,182,149)","weight":0.003215477},{"class":"vs.vscore.colorextract.ApiColorExtractResultEntry","clrName":"Green|绿(ExactName:DarkOliveGreen)","rgbHexString":"#3c542c","rgbString":"rgb(60,84,44)","weight":0.002110157}]



Download Java resources
Download Python resources
Download Php resources

Error Code Reference:


Error Codes Related to Access Control:
API_CODE_ERROR_exceeded_access_total Exceeded API access limit in total
API_CODE_ERROR_exceeded_access_frequency Exceeded API access frequency limit
API_CODE_ERROR_exceeded_access_frequency_min Exceeded API access limit per minute
API_CODE_ERROR_exceeded_access_frequency_hr Exceeded API access limit per hour
API_CODE_ERROR_exceeded_access_frequency_day Exceeded API access limit per day
API_CODE_ERROR_exceeded_access_frequency_month xceeded API access limit per month
API_CODE_ERROR_two_API_calls_time_too_close Two API calls are too close in time
IMAGE_INDEX_CODE_ERROR_IMAGE_EXCEED_MAX_DOCS_PER_UID Exceeded max number of images in index per user
API_CODE_ERROR_not_allow_write_index Pause in adding image to index (server might be in maintain service, please wait )

Error Codes Related to Wrong Parameters:
API_CODE_ERROR_invalid_apikey Invalid apikey
IMAGE_INDEX_ITEM_CODE_ERROR_INVALID_imgName Invalid image name
IMAGE_INDEX_ITEM_CODE_ERROR_INVALID_imgUrl Invalid image URL
IMAGE_INDEX_ITEM_CODE_ERROR_INVALID_catid_must_be_1_to_3000 Invalid image category (Must be 1-3000 Integer)
IMAGE_INDEX_ITEM_CODE_ERROR_INVALID_labels_must_be_positive_integer Invalid label(Must be positive integer)
IMAGE_INDEX_ITEM_CODE_ERROR_INVALID_FIELDS_any_field_must_not_have_double_quote Invalid image data, must not have double quote
IMAGE_INDEX_ITEM_CODE_ERROR_INVALID_LANG Invalid language parameter(must be zh for Chinese or en for English)
IMAGE_INDEX_CODE_ERROR_DOWNLOAD_IMAGE Error in downloading image, please check provided image URL
IMAGE_INDEX_CODE_ERROR_IMAGE_SIZE_TOO_BIG Image size is too big(image must be 400 – 800PIX JPG format)
IMAGE_INDEX_DELETE_IMG_CODE_ERROR_NOT_FOUND_ITEM Error in deleting, image not found