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
You can use PHP to get an array of the color palette like so:
\n";
foreach($palette as $color)
{
echo " #$color \n";
}
echo "\n";
Which gives you an array whose values are higher for how often that color has been used.
EDIT A commenter asked how to use this on all files in a directory, here it is:
if ($handle = opendir('./path/to/images')) {
while (false !== ($file = readdir($handle))) {
$palette = colorPalette($file, 10, 4);
echo "\n";
foreach($palette as $color) {
echo " #$color \n";
}
echo "
\n";
}
closedir($handle);
}
might not want to do this on too many files, but it's your server.
Alternatively if you'd rather use Javascript Lokesh's Color-Theif library does exactly what you're looking for.