PLEASE RELOAD
Transparency



Info

Both regular and transparent colors may be used on the same image. If you use a transparent background you will have to draw your shape in a true color as the shape background. Then the same shape, same location with transparent color. If you do not do this your transparent color will change depending on the background you eventually put your image on. You may also make your background white or some color; do your images in transparent colors and take the final image either ping, jpeg, or gif, to Image Magickand matte your background...floodfill.

Degree of transparency

Transparent Alpha values begin with zero which is opaque and end at 127 which is transparent. Any number between those two may be used....higher the number, higher the transparency.

Allocating

To allocate a transparent color we add the alpha component. imageColorAllocateAlpha. The RBG color number is used like always, and after the color number is the transparency number. Here's an example allocating yellow as transparency factor 80.
//$yellow = imagecolorallocatealpha($im, 255, 255, 0, 80);

Allocating for Both

If you want yellow to be transparent in one part of your image and not transparent in another part of the image, just name them differently. For example:
//$yellowT = imagecolorallocatealpha($im, 255, 255, 0, 20);

//$yellow = imageColorAllocate($im, 255, 255, 0);

Allocating for Different Transparencies

If you want the same color to be different factors of transparency just name them differently. For example:
//$yellowT = imagecolorallocatealpha($im, 255, 255, 0, 20);

//$yellowTT = imagecolorallocatealpha($im, 255, 255, 0, 80);




These are the same shapes as in previous lessons. We just add our transparent colors.


http://www.simplysally.com/GD/lessons/lesson5.txt


GD BasicsHome