Re: imagecreatefromgif & imagecolortransparent() ??

From: Date: Thu, 04 Dec 2008 16:31:14 +0000
Subject: Re: imagecreatefromgif & imagecolortransparent() ??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-284101@lists.php.net to get a copy of this message
Here's a code snippet from the php.net documentation on imagecolortransparent by Blaine Ehrhart <?php $im = imagecreatefromgif('trans.gif'); $img = imagecreatetruecolor(16,16); $trans = imagecolorallocate($img,255,99,140); imagecolortransparent($img,$trans); imagecopy($img,$im,0,0,0,0,16,16); imagetruecolortopalette($img, true, 256); imageinterlace($img); imagegif($img,'trans.gif'); imagedestroy($img); ?> See if it works. On Thu, Dec 4, 2008 at 10:44 AM, LucaP <lucapost@gmail.com> wrote: > > Hi all, the simple code snippet: > > header('Content-type: image/gif'); > $im = imagecreatefromgif("/path/Mypic.gif"); > $background = imagecolorallocate($im, 255, 255, 255); > imagecolortransparent($im,$background); > > imagegif($im,'/path/TransparentPic.gif'); > imagedestroy($im); > > > is creating the new image but is not setting the white background to > transparent; > I am sure about the presence of the white color in the background > (checked it with imagecolorat() etc). > > a similarly simple test setting transparency on a new image created > with 'imagecreatetruecolor()' works correctly... any hints?! > > Cheers, Luca > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#284101) next »