Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transparency in GD

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I am getting some unexpected results from attempts to use transparency in GD.
I have been playing around with the following code, using various options but to no avail
Code:
// Create an image
$FullPic = ImageCreateTrueColor(640,640);  	

// create a color
$Trans = imagecolorallocate($FullPic, 200,200,200);  	

// Fill it with transparent colour
imagefilledrectangle ( $FullPic , 0 , 0 , 640, 640 , $Trans );

// Set previous colour to transparent
imagecolortransparent($FullPic, $Trans);

// Sample Full Pic
ImageGIF($FullPic);
Picture is not transparent.
This is part of a much bigger picture but I would have thought this function would be one of the easier ones.
Am I missing something obvious here?

I also need transparency in a rotated image but the same issue may be resolved here.


Keith
 
works for me in that i get a blank image. take away the transparency and i get a green image (i changed the colors to 0, 255, 0)

i can also vary the opacity by setting the alpha channel using imagecolorallocatealpha()
 
quite possibly. the gd library gets updated from time to time.

i am using

php CGI 5.2.5
GD 2.0.34 with FT 2.2.1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top