Re: [GD-DEVEL] GDlib puts bug on tux in my win2k

[email protected] (Pierre)
Newsgroups php.gd.devel
Message-ID <[email protected]>
Hi,

On Jan 16, 2008 11:50 AM, oyster <[email protected]> wrote:
> thanx, gdImageCreateTrueColor works right
>
> but why gdImageCreate fails? Why does gdImageCreate turn the other
> colors in palette into grey( we can save a truecolor pic to a pic in
> 256-color-pallete format, but it is still colorful, and is no grey)?

If the allocation of new colors failed (for example if the 256 colors
have been allocated already), GD will then try to find the most
closest alternative in the current palette.


> I cannot undersatnd the above questions and find no docs on them too.
> If that is a feature of gd, I think it is better to mention it in the
> document; else, I think it is a bug need to be fixed.

The JPEG format does not support palette based images (created by
gdImageCreate) but only true color 24bits image. It is best to work
with gdImageCreateTrueColor when an image is loaded from JPEG or PNG
24bit (PNG can have palette based images).

Once you are done with your operations and if you like to save your
images as gif or as palette based PNG, you can always convert it using
gdImageCreatePaletteFromTrueColor. GD 2.1.0 will even have a greatly
improved result, take a look here: http://pierre.libgd.org/nnquant/

I hope I have answered your questions :)

Cheers,
-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.