我正在试图弄清楚如何查看图像中有多少颜色。

I'm trying to figure out how to see the amount of total images in an image and when I run this script only thing that happens on the page is it prints a 00.

$img = imagecreatefrompng('C:/wamp/www/button.png');
$image = imagecolorstotal($img);
echo($image);
print_r($image);

Manual suggests that 0 is returned for truecolor images. You can check if your image is truecolor using the below:

var_dump(imageistruecolor($img));

If it dumps true, getting a 0 return from imagecolorstotal is logical.