This is an utility to calculate the mean color of a png file and print the resulting color in HEX format, suitable for use on CSS and HTML.
I really liked the way Chrome picks the color used around thumbnails of websites on their "Most Visited" page and wanted to do that on a program I was developing so I found this thread on Quora explaining the algorithm and pointing to the code location on Chromium repository.
The original code needed Skia
to work and had a bunch of dependencies.
I removed all dependencies except libpng
and maintained the BSD-style license
of the original code.
You can build it using cmake:
$ git clone https://github.com/edufelipe/png-mean-color.git
$ mkdir build && cd build
$ cmake ../ && make
$ cp png-mean-color /usr/local/bin
Then all you have to do is pass in a PNG file:
$ png-mean-color some_file.png
#fe6f04