I'm experiencing an issue with the way the GD/libpng and/or PHP is loading an existing PNG graphic and apparently messing up the color index (or something along those lines) either upon loading or somewhere before the final output.
The PHP platform is Redhat 7.2 i386 w/ the following package versions (installed as RPMs):
- Apache 1.3.27
- PHP 4.1.2
- GD 1.8.4
- libpng 1.0.14
The comments in the on-line PHP Manual acknowledge the problem, but don't seem to offer a solution short of modifying the input files themselves. In my situation, let's say that I don't have that option (i.e., I must deal with the files as they are submitted--I have no way of massaging the input).
Here are 2 screenshots of what I'm talking about. The first one is the actual image loaded up in Mozilla:

Now, here is the same image when I load the PNG from a file via imagecreatefrompng() and print it out again:

I got the same results in IE as well.
Here is the source of the image_test.php script where I load the image and print it out:
Code: Select all
<?php
$im = imagecreatefrompng("green-button.png");
Header("Content-type: image/png");
imagepng($im);
?>Thanks,
dbcooper