PHP.nl

imagecolorstotal

imagecolorstotal

Find out the number of colors in an image's palette

int **imagecolorstotal** GdImage $image

Returns the number of colors in an image palette.

Returns the number of colors in the specified image's palette or 0 for truecolor images.

**Voorbeeld: Getting total number of colors in an image using **

<?php
// Create image instance
$im = imagecreatefromgif('php.gif');

echo 'Total colors in image: ' . imagecolorstotal($im);
?>
Total colors in image: 128

imagecolorat``imagecolorsforindex``imageistruecolor