Re: [GD-DEVEL] Newbie transparent gif question- possibly solved.
| From: | Pierre Joye | Date: | Fri, 02 May 2008 11:49:40 +0000 |
| Subject: | Re: [GD-DEVEL] Newbie transparent gif question- possibly solved. | ||
| References: | 1 2 3 4 5 | Groups: | php.gd.devel |
| Request: | Send a blank email to php-gd-devel+get-423@lists.php.net to get a copy of this message | ||
On Fri, May 2, 2008 at 1:28 PM, Roger Oberholtzer <roger@opq.se> wrote:
> On Fri, 2008-05-02 at 12:26 +0200, Roger Oberholtzer wrote:
> > Hello
> >
> > I know, bad form to follow one's own post. I have more info, but no
> > solution.
>
> And here I go again.
>
> I think that I wind up with the color I want to be transparent being
> defined more than once in the color map. Due to the way my code is
> written, it could wind up setting the transparent color to a later
> duplicate instance of the desired transparent color. Then it is no
> longer going to be transparent. If I ensure that the transparent color
> is defined as the first one, AND that I only set the transparent color
> to this index (0), then all is ok. I think that my code wound up setting
> the transparent color to the correct color, but the color was a
> duplicate at some place other than 0 in the color map.
>
> IMHO, the function gdImageColorTransparent is not fully correct, at
> least when making a GIF. The second argument seems to need to be 0.
> Anything else results in loff of transparency.
That's not correct. It works as expected by using a color index (not a
color value!) for palette images and a color value for true color
images.
I don't have the time now to give you a small examples but it does
work as expected. You can take a look in the examples or tests
directories, a couple of them use the transparent color.
Cheers,
--
Pierre
http://blog.thepimp.net | http://www.libgd.org