note 38426 added to function.imagecolorstotal
| From: | jonathan dot gotti at free dot fr | Date: | Sat, 20 Dec 2003 10:40:27 +0000 |
| Subject: | note 38426 added to function.imagecolorstotal | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62270@lists.php.net to get a copy of this message | ||
Voici une fonction pour compter le nombre de couleurs réellements utilisé dans une image gd;
/**
* get really used colors
* @author jonathan.gotti@free.fr
* @date 2003-12-20
* @param ressource image $img
* @return int
*/
function imagecolorcount($img){
$width = imagesx($img);
$height= imagesy($img);
for($x=0;$x<$width;$x++){ #chaque ligne de l'image
for($y=0;$y<$height;$y++){ #chaque colonnes
$colors[imagecolorat($img,$x,$y)]=TRUE;
}
}
return count($colors);
}
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorstotal.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38426
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38426&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38426&report=yes
Search -- http://master.php.net/manage/user-notes.php