Imagick::getImageColors


wizard apg

GETS the number of unique Colors in a image.



<?php

int 
public Imagick::getImageColors();

?>

 


This function has no parameters.





Returns the number of image Colors.




RANDOMIZED COLOR

Each new run, a new color is shown.

rgb code hexadecimal color
38, 192, 145#26c091
ed48

  1 EXERCISE   

<?php 

$imagick1 
= new imagick(PATH2IMGW '/jpg/aa.jpg');

$nbrColors1 $imagick1->getImageColors();

echo 
"The image number of Colors is " $nbrColors1;

?>

 RESULT   

aa.jpg

img/jpg/aa.jpg apr

The image number of Colors is 325566

  2 EXERCISE   

<?php 

$imagick2 
= new imagick(PATH2IMGW '/gif/E 01 01.gif');

$nbrColors2 $imagick2->getImageColors();

echo 
"The image number of Colors is " $nbrColors2;

?>

E 01 01.gif

img/gif/E 01 01.gif apr

The image number of Colors is 252

  3 EXERCISE   

<?php 

$imagick3 
= new imagick(PATH2IMGW '/others/sign.png');

$nbrColors3 $imagick3->getImageColors();

echo 
"The image number of Colors is " $nbrColors3;

?>

sign.png

img/others/sign.png apr

The image number of Colors is 159