#22413 [Opn->WFx]: imagecolorstotal() returns 0 from 24 bit colour images
| From: | iliaa@php.net | Date: | Tue, 25 Feb 2003 14:55:49 +0000 |
| Subject: | #22413 [Opn->WFx]: imagecolorstotal() returns 0 from 24 bit colour images | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-34225@lists.php.net to get a copy of this message | ||
ID: 22413
Updated by: iliaa@php.net
Reported By: skotske at hotmail dot com
-Status: Open
+Status: Wont fix
Bug Type: GD related
Operating System: Linux
PHP Version: 4.3.0
New Comment:
24/32 bit color images have too many colors to count. In order to offer
the requested functionality PHP would need to go through every single
pixel of the image analyzing the colors used and creating an array of
stored colors. This is simply way too slow & memory consuming to be
implemented.
Previous Comments:
------------------------------------------------------------------------
[2003-02-25 04:38:31] skotske at hotmail dot com
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 this bug report at http://bugs.php.net/?id=22413&edit=1