I have an website where people share photographs . I am generating Photo Histogram value.. I want to design the histogram chart using the value of RGB.
How I can develop chart for histogram?
I am expecting output in the form of chart !
<?php
$image = new Imagick("thing.png");
$pixels=$image->getImageHistogram();
foreach($pixels as $p){
$colors = $p->getColor();
foreach($colors as $c){
print( "$c\t" );
}
print( "\t:\t" . $p->getColorCount() . "
" );
}
?>
This will print out something like:
252 250 252 1 : 125
194 156 182 1 : 126
109 18 79 1 : 11440
2 117 162 1 : 12761
255 255 255 1 : 40769
...where the colums are red, green, blue, alpha, followed by the number of times that colour appears in the image.
if i were you i would get a premade chart library like on this link
and then just feed the values to it