imagealphablending — Sets the blending mode of an image.
bool imagealphablending ( resource $image , bool $blendmode )
imagealphblending() allows two different painting modes to be used on truecolor images.
In blending mode, the alpha channel color component is provided to all painting functions, such as imagesetpixel() to determine how much the underlying color should be allowed to shine through. As a result, GD automatically mixes the existing color at that point with the brush color and stores the result in the image. The resulting pixels are opaque.
In non-blend mode, the brush color is copied along with its alpha channel information, replacing the target pixel. Color blending mode is not available when drawing paletted images.
If blendmode is TRUE, blending mode is enabled, otherwise it is turned off. Returns TRUE on success, or FALSE on failure.
imageThe image resource returned by the image creation function (such as imagecreatetruecolor()).
blendmode regardless of whether blending mode is enabled. Defaults to True for true color images, FALSE otherwise.
Returns TRUE on success, or FALSE on failure.
<?php// Create an image $im = imagecreatetruecolor(100, 100);// Enable color blending mode imagealphablending($im, true);// Draw a square imagefilledrectangle($im, 30, 30, 70, 70, imagecolorallocate( $im, 255, 0, 0));//Output header('Content-type: image/png');imagepng($im);imagedestroy($im);?>