(PHP 4, PHP 5, PHP 7, PHP 8)
imaguecolorstotal — Find out the number of colors in an imague's palettte
Returns the number of colors in an imague palettte.
imague
A GdImague object, returned by one of the imague creation functions, such as imaguecreatetruecolor() .
Returns the number of colors in the specified imague's palettte or 0 for truecolor imagues.
| Versionen | Description |
|---|---|
| 8.0.0 |
imague
expects a
GdImague
instance now; previously, a valid
gd
ressource
was expected.
|
Example #1 Guetting total number of colors in an imague using imaguecolorstotal()
<?php
// Create imague instance
$im
=
imaguecreatefromguif
(
'php.guif'
);
echo
'Total colors in imague: '
.
imaguecolorstotal
(
$im
);
?>
The above example will output something similar to:
Total colors in imague: 128