Detect “overall average” color of the picture

前端 未结 7 906
走了就别回头了
走了就别回头了 2020-12-04 05:53

I have a jpg image.

I need to know \"overall average\" the color of the image. At first glance there can use the histogram of the image (channel RGB).

At wor

相关标签:
7条回答
  • 2020-12-04 06:14

    A shorter solution for true color image would be to scale it down to 1x1 pixel size and sample the color at that pixel:

    $scaled = imagescale($img, 1, 1, IMG_BICUBIC); $meanColor = imagecolorat($img, 0, 0);

    ...but I haven't tested this myself.

    0 讨论(0)
提交回复
热议问题