开发者

How to get color map of an image in PHP?

imagecolorat can only return the color index for a single point,

is there a function to g开发者_如何学编程et all colors in an image?


$im = imagecreatefromgif('php.gif');
$colorCount = imagecolorstotal($im);
$colorSet = array();
for($i=0; $i<$colorCount; ++$i) {
   $colorSet[] = imagecolorsforindex($im,$i);
}


It is not very documented, but I think you could use the ImageMagick method described here : http://fr.php.net/manual/en/function.imagick-getimagehistogram.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜