ID: 21668 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: *Graphics related Operating System: Win32 / OSF1 PHP Version: 4.2.3 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The color_index parameter for imagecolorsforindex() can be generated by imagecolorat(). That function can only fetch the avaliable 3 colors of the image, hence all other colors cannot be resolved regardless of the palette. This works the same way in GD 2.X bundled with PHP as it does with you GD 1.8.4 Previous Comments: ------------------------------------------------------------------------ [2003-01-15 12:47:59] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [2003-01-15 12:34:09] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php According to my tests that image only contains 3 colors: 255,255,255 0, 0, 0 204, 204, 204 There is definately no 0,0,153 color. ------------------------------------------------------------------------ [2003-01-15 11:49:31] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21668&edit=1