Help Center/ Object Storage Service/ Image Processing/ Getting the Average RGB Value of an Image
Updated on 2024-08-09 GMT+08:00

Getting the Average RGB Value of an Image

You can get the average RGB value of an image only by making an API call.

The returned average RGB value is a hexadecimal string in JSON.

This operation is represented by average-hue.

Example

Below gives an example of querying the average RGB value of the example.jpg image:

https://hw-image-demo.obs.ap-southeast-1.myhuaweicloud.com/example.jpg?x-image-process=image/average-hue

If information similar to the following is displayed, the average RGB value of the image is obtained:

{"RGB":"#28577D"}

Original example.jpg image:

Color corresponding to the average RGB value (#28577D):