From: skotske at hotmail dot com Operating system: Linux PHP version: 4.3.0 PHP Bug Type: GD related Bug description: imagecolorstotal() returns 0 from 24 bit colour images
When assigning the number of colours to a variable imagecolorstotal() returns 0. $total = imagecolorstotal($image); echo($total); I was testing the greyscale example from here: http://www.php.net/manual/en/function.imagecreatetruecolor.php GD installed: GD Support enabled GD Version bundled (2.0 compatible) FreeType Support enabled FreeType Linkage with freetype GIF Read Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled Tests. I tried this with: gif - returns 256 jpeg (24bit colour) - returns 0 png 8bit - returns 256 png 24bit - returns 0 All the same image source image saved to the different formats from photoshop. I've also tested the script on an older redat install and it works for all (well kinda - returns max 256, but that's an old release so who cares) details of the older machine: PHP Version 4.1.2 GD Support enabled GD Version 1.6.2 or higher FreeType Support enabled FreeType Linkage with TTF library JPG Support enabled PNG Support enabled WBMP Support enabled Ideally you'd want more than 256 colors anyway? And maybe that's what supposed to happen? Saw a couple of non-english postings about it in google groups from what I could make out I've also searched the bug database and could only find a passing mention as an aside to a different bug so...... -- Edit bug report at http://bugs.php.net/?id=22413&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22413&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22413&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22413&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22413&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22413&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22413&r=support Expected behavior: http://bugs.php.net/fix.php?id=22413&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22413&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22413&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22413&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22413&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22413&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22413&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22413&r=gnused