imgAve

Last updated:2021-11-02 17:53:48

Operation

imgAve

Description

You can call this operation to query the dominant color of an image and calculate the average color of the image. The result is returned in the 0xRRGGBB format.
Supported image formats: JPG, JPEG, BMP, PNG, WebP, TIFF, PCX, SVG, HT, GIF, and WBMP.
Unsupported image formats: AI, TGA, PSD, EPS, RAW, and PCD.

Permission

To call this operation, you must have the GetObject permission. If the object does not exist, the following errors may be returned:

  • If you have the ListBucket permission on the bucket where the object resides, KS3 returns a 404 error.
  • If you do not have the ListBucket permission on the bucket, KS3 returns a 403 error.

Request

Syntax

https://BucketName.${Endpoint of the bucket}/object@base@tag=imgAve HTTP/1.1
Host: BucketName.${Endpoint of the bucket}

Request parameters

You do not need to set parameters for this request.

Request header

The request does not require a special header.

Response

Response header

Header Required Description
Content-Type Yes The MIME type, which is fixed to application/json.

Response body

The response is provided in a JSON string.

Field Description
RGB The dominant color of the image, in the 0xRRGGBB format.

Operation-specific errors

HTTP status code Description
400 The request format is incorrect.
404 The specified resource does not exist.
403 The access is denied.
500 An internal server error occurred.

Examples

1. Enter the following request in the address bar of your web browser:
https://ks3-resources.ks3-cn-beijing.ksyuncs.com/kssyun.png@base@tag=imgAve

2. Sample response   
{
	"RGB":"0x6c6d74"
}

Did you find the above information helpful?

Unhelpful
Mostly Unhelpful
A little helpful
Helpful
Very helpful

What might be the problems?

Insufficient
Outdated
Unclear or awkward
Redundant or clumsy
Lack of context for the complex system or functionality

More suggestions

0/200

Please give us your feedback.

Submitted

Thank you for your feedback.

问题反馈