Re: [GD-DEVEL] Newbie transparent gif question- possibly solved.

[email protected] ("Pierre Joye") Fri, 2 May 2008 14:57:12 +0200
Newsgroups php.gd.devel
Message-ID <[email protected]>
On Fri, May 2, 2008 at 2:31 PM, Roger Oberholtzer <[email protected]> wrote:

>  Thanks! Be sure to do one where you Allocate a color more than once, and
>  set the transparency to one after the first Allocate of the color.


Do you understand what I mean by:

It uses only the color index with palette images.

?


im = gdImageCreate(100,100);
for (i=0; I<256;i++) {
  a[i] = gdImageColorAllocate(im, 255,0,0);
}

gdImageColorTransparent(im, 23);

That will tell GD to use the index number 23 as transparent color. The
index is what is stored in the image, and not the color values. It
does not matter if the 254 other indexes have the exact same value.

Cheers,
-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org