note 41445 deleted from function.imagecolorstotal by hholzgra
| From: | hholzgra@php.net | Date: | Sun, 05 Mar 2006 17:19:54 +0000 |
| Subject: | note 41445 deleted from function.imagecolorstotal by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-104854@lists.php.net to get a copy of this message | ||
Note Submitter: Felix Rusu <webmaster at betania dot ro>
----
Actually that is not true.
When you use for example imagecreatefromjpeg() you create a truecolor image resource (as with the
other truecolor image types). If you try to get the number of colors using imagecolorstotal() you
get 0 (thats what happened to me at least). Instead you must convert the trucolor resource to
pallete resource. You have to do that like this:
<?
$simg=createfromjpeg("somejpeg.jpg");
imagetruecolortopalette($simg, false, 256);
$colors=imagecolorstotal($simg);
?>
Check the manual for the function signature.
Cheers.