PHP Classes


Recommend this page to a friend!

      GIF images into animated GIF with native PHP class  >  All threads  >  GIFEncoder  >  (Un) Subscribe thread alerts  
Summary:Transparent background showing as white
Author:Paul Michali
Date:2007-04-22 16:34:35
Update:2013-05-11 22:10:38


  1 - 10   11 - 18  

  1. GIFEncoder   Reply   Report abuse  
Paul Michali - 2007-04-22 16:34:35
I'm trying this class and I have several GIFs, all of which have a transparent background. When I display the individual gifs on my web site, they all show up with the background color of the web page. But, when I use this class to process the images into an animated GIF, the background of each image is set to white.

I've tried passing in -1, 0, and the three background colors for the transparency arguments, but the background is still set to white. I'm not sure what I'm doing wrong. Any help would be appreciated. Here is what I'm doing right now for the call:

for($i=0; $i < $conn->num_rows; $i++) {
$row = $conn->fetch_row();
$files[] = LOGO_PATH . "bkgnd-" . $row[0];
$delay[] = 500; // 5 second delay between frames
$gif = new GIFEncoder($files, $delay, 0, -1, -1, -1, -1, "url");

Thanks in advance.

  2. Re: GIFEncoder   Reply   Report abuse  
László Zsidi - 2007-04-23 03:41:28 - In reply to message 1 from Paul Michali

Please send me each source images and main script via email.
( )

  3. Re: GIFEncoder   Reply   Report abuse  
László Zsidi - 2007-04-23 03:44:59 - In reply to message 1 from Paul Michali
I just thought the stored white tranparent pixel color values in the images are 252, 254, 252.
Try these values...

  4. Re: GIFEncoder   Reply   Report abuse  
Paul Michali - 2007-04-23 22:59:18 - In reply to message 3 from László Zsidi
I tried 252, 254, 252 for the transparency values and it still shows the transparent area as white. I'll e-mail you some of the images and the function I use.

Thansk for the help!

  5. Re: GIFEncoder   Reply   Report abuse  
Paul Michali - 2007-05-04 21:22:05 - In reply to message 2 from László Zsidi
Did you get a chance to look at the GIFs and code snippet I sent?

I can't seem to figure out how to keep the background transparent (though I'm a newbie, when it comes to this GIF file format stuff).

Thanks in advance!

  6. Re: GIFEncoder   Reply   Report abuse  
László Zsidi - 2007-05-06 20:14:55 - In reply to message 5 from Paul Michali
Dear Paul!

I'm so sorry, I tried to search a soution for your problem, but I could not find for now.
Sorry my free time is very limited for my hobbies, but I don't forget you!
Thought, I will create a transparent pixel found script for GIFEncoder as an extension resolve image transparent troubles.

I'm calling shortly.


  7. Re: GIFEncoder   Reply   Report abuse  
Paul Michali - 2007-05-08 10:26:25 - In reply to message 6 from László Zsidi
Thanks! I appreciate your help on this. I have a workaround, namely to create a duplicate of each image with the transparent region set to the current background used on the web site.

However, it requires that I have two copies of each image (one for display on pages, where the background color varies, and one with no transparency that is used in the animated GIF). This process more manual (as I need to create the non-transparent version of the image, using the current background color for the page where the image is displayed).

IOW, these images appear individually on pages where the background is white, but they also appear in an amimated GIF, where the background is a shade of blue (currently). The images are all with transparency, and when I use Paint Shop Pro to generate the animated GIF, it works fine.

Unfortunately, when I'm trying to automate the generation the animated GIF, allowing people to add/remove transparent images from the GIF, and then re-building the animated GIF, I'm getting a white background, instead of the transparent background.

I don't know much about the transparent GIFs, so any advice you may have on this would be appreciated!

  8. Re: GIFEncoder   Reply   Report abuse  
Corby Johanneson - 2007-09-05 01:26:24 - In reply to message 6 from László Zsidi
Hi guys - I'm having this problem as well. I just can't set the transparency for my merged GIF not matter what I try.

I've looked at my animated GIF file that GIFEncoder Class creates and have found that the color I'm trying to set as the background *is* in fact RGB(252,254,252) - and I've verified that I'm passing that info in the correct order, but no go.

I also noticed that when I load the GIF into two different GIF-Animation programs, they both tell me that the background transparency color has not even been set... this makes me think that I'm doing something wrong, but I'm really not sure. I've looked at the Class code, but it's over my head.

In any case, here's my call to the Constructor:
$gif = new GIFEncoder($frames,$framed,0,2,252, 254, 252,"url");

Here's the URL of a page with the GIF:

Now, regarding the earlier posts here - did you ever get around to writing that script that sets the background transparency of a GIF, László???


  9. Re: GIFEncoder   Reply   Report abuse  
László Zsidi - 2007-09-09 20:33:34 - In reply to message 8 from Corby Johanneson
Hi all,
Excuse me, but I was in holiday until one month...
I will review all problems included zero's problem.


  10. Re: GIFEncoder   Reply   Report abuse  
Shin Zaiaku - 2007-09-21 02:12:33 - In reply to message 9 from László Zsidi
Yeah I'm having the same problem. Even if you match the color perfectly it still remains white. I'm constantly trying to find a work around but so far I've came up empty for a solution.

  1 - 10   11 - 18