Re: 256colour PNG?? WHY?!
| From: | Rasmus Lerdorf | Date: | Sat, 21 Sep 2002 13:24:56 +0000 |
| Subject: | Re: 256colour PNG?? WHY?! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117091@lists.php.net to get a copy of this message | ||
gd1 is limited to 256 colours. Use gd2.
On Sat, 21 Sep 2002, -=| Julien Bonastre |=- wrote:
> Hmm.. Interesting problem I seem to have stumbled upon
>
>
> I am running apache2.0.36 and php4.2.2 (i am using gd1.6.2)
>
> Now the catch is.. I just want to output a few diff image types directly to browser..
>
> I can do JPEG's fine.. BMP's don't work because of using a older gdlib..
> that's no big deal though.. i just wanted jpeg and hopefully PNG..
>
> Thing is.. PNG's well.. it loads them fine.. but they end up 256colour palette in the
> browser.. it actually creates the new image from the original true colour (~24KB original) and
> instead spits out a 256colour ~4KB version.. since the palette's been reduced involuntarily
> this is not the desired effect..
>
> I run the img resource through imagecolorstotal($img) to get the colour palette. sure enough..
> it returns 256.. and yet i open the PNG in Photoshop and its a truecolour PNG and without
> discolouration..
>
>
> It's definitely freaking me out since I have no idea why it's doing it. I started
> reading the docs' more closely to see if it was a known issue and that the png func's are
> supposed to return 256 colour images.. but to no avail..
>
>
> Below is the code of the very simple (as can be seen) test php page:
> <?
> header("Content-type: image/png");
> //header("Content-Disposition: image; filename=test");
> $img=imagecreatefrompng("./news/n1d1.png");
> //imageinterlace($img,1);
> imagepng($img);
> ?>
>
>
>
> As can be seen.. It's very simple.. hehe.. I was just using it to test the principle but
> even at these early stages the plan fell apart due to this wacky problem..
>
>
>
> Thanks for any ideas/advice..
>
> :) greatly appreciated..
>
> ------oOo---------------oOo------
>
> Julien Bonastre [The_RadiX]
> The-Spectrum Network CEO
> the_radix@the-spectrum.org
> www.the-spectrum.org
>
> ------oOo---------------oOo------
>
>