PHP | imagealphablending() Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The imagealphablending() function is an inbuilt function in PHP which is used to set the blending mode for an image. This function allows to two different modes (blending mode and non-blending mode) to drawing truecolor images. Blending mode is not available when drawing used palette images. Syntax: bool imagealphablending( $image, $blendmode ) Parameters: This function accepts two parameters as mentioned above and described below: $image: It is returned by one of the image creation functions, such as imagecreatetruecolor(). It is used to create size of image. $blendmode: This parameter is used to check the blending mode is enable or not. The default value is True for true color image and False otherwise. Return Value: This function returns True on success or False on failure. Below programs illustrate the imagealphablending() function in PHP: Program 1: php <?php // Create an image of given size $image = imagecreatetruecolor(300, 500); // Set alphablending to on imagealphablending($image, true); // Set the background color of image. $background_color = imagecolorallocate($image, 255, 255, 255); // Fill background with above selected color. imagefill($image, 0, 0, $background_color); // Draw a square of given size imagefilledrectangle($image, 50, 50, 450, 250, imagecolorallocate($image, 0, 255, 0)); // Output image header('Content-Type: image/png'); imagepng($image); imagedestroy($image); ?> Output: Program 2: php <?php // Create an image from png $image = imagecreatefrompng( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png'); // Set alphablending to image imagealphablending($image, true); // Create color of image $green = imagecolorallocate($image, 0, 255, 0); // Create rectangle imagerectangle($image, 5, 10, 660, 100, $green); // Output image header('Content-Type: image/png'); imagepng($image); imagedestroy($image); ?> Output: Reference: https://www.php.net/manual/en/function.imagealphablending.php Create Quiz Comment V vijay_raj Follow 0 Improve V vijay_raj Follow 0 Improve Article Tags : Web Technologies PHP PHP-function Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like