Get average color of image via Javascript

后端 未结 12 2151
终归单人心
终归单人心 2020-11-22 17:01

Not sure this is possible, but looking to write a script that would return the average hex or rgb value for an image. I know it can be done in AS

12条回答
  •  不要未来只要你来
    2020-11-22 17:50

    This is about "Color Quantization" that has several approachs like MMCQ (Modified Median Cut Quantization) or OQ (Octree Quantization). Different approach use K-Means to obtain clusters of colors.

    I have putted all together here, since I was finding a solution for tvOS where there is a subset of XHTML, that has no element:

    Generate the Dominant Colors for an RGB image with XMLHttpRequest

提交回复
热议问题