: This article mainly introduces the main colors of PHP images. For more information about PHP tutorials, see. The php image extension is used in the code. Therefore, you need to install the Imagick extension of PHP before using it. the specific installation is as follows (under the window ):
Http://blog.csdn.net/shaerdong/article/details/46639245
quantizeImage( 10, Imagick::COLORSPACE_RGB, 0, false, false );$average->uniqueImageColors();functionGetImagesColor( Imagick $im ){$colorarr = array(); $it = $im->getPixelIterator(); $it->resetIterator(); while( $row = $it->getNextIteratorRow() ){ foreach ( $rowas$pixel ){ $colorarr[] = $pixel->getColor(); } } return$colorarr;}$colorarr = GetImagesColor($average);foreach($colorarras$val){ $r += $val['r']; $g += $val['g']; $b += $val['b']; echo"
";}$r = round($r/10);$g = round($g/10);$b = round($b/10);echo"
";?>
The above introduces the main color of the PHP image, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.