|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-15 11:49 UTC] phpbugs at dronkert dot net
I created an 8-bit paletted png image using PHP, allocating the complete webpalet 51*(r,g,b) with r,g,b in [0,5]. See http://www.phys.uu.nl/~varsity/rowperfect/ - env.php only contains phpinfo(). - grid.php creates "grid.png" in the png subdir. - test.php tries to analyze the colour palette. As you can see the colour (0,0,153) definitely exists in the palette and has index number 212. However, when searching for this colour imagecolorexact() does not return a valid index value (-1) and imagecolorclosest() returns the highest index number (215) which is black (0,0,0). Even worse is imagecolorresolve(): it evidently picks another index (214) and just replaces the existing colour at that position with (0,0,153). The behaviour is exactly the same on this webserver (OSF1, Apache 1.3.27, PHP 4.2.3, GD 1.8.4) as on my home system (Win2k, Apache 2.0.43, PHP 4.3.0-dev, GD 2 built-in). The png image (http://www.phys.uu.nl/~varsity/rowperfect/png/grid.png) renders faultless in IE6, Moz121, Corel Photopaint 9. If you want I can send the grid.php/test.php source. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 16:00:01 2025 UTC |
The image does indeed only contain (display) the 3 colours you mention. The embedded palette however definitly defines 216 colours, as shown by the output of test.php or: for ( $i = 0; $i < imagecolorstotal( $im ); ++$i ) { $c = imagecolorsforindex( $im, $i ); echo "$i = {$c['red']} {$c['green']} {$c['blue']}\n"; } Corel Photopaint also shows me a 216-colour palette.