PHP | imagealphablending() Function Last Updated : 23 Aug, 2019 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: http://php.net/manual/en/function.imagealphablending.php Comment More infoAdvertise with us Next Article PHP | imagealphablending() Function V vijay_raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | imagepng() Function The imagepng() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to PNG and applying filters to the image. Syntax: bool imagepng( resource $image, int $to, int $qual 2 min read PHP | imagesavealpha() Function The imagesavealpha() function is an inbuilt function in PHP which is used to set whether to retain full alpha channel information when saving PNG images or not. Alpha channel tells whether the image is fully transparent or opaque. Alpha blending has to be disabled using imagealphablending($im, false 2 min read PHP | imagejpeg() Function The imagejpeg() function is an inbuilt function in PHP which is used to display image to browser or file. The main use of this function is to view an image in the browser, convert any other image type to JPEG and altering the quality of the image. Syntax: bool imagejpeg( resource $image, int $to, in 2 min read PHP | imageaffine() Function The imageaffine() function is an inbuilt function in PHP which is used to get an image containing the affine transformed src image using an optional clipping area. Affine is a geometric transformation operation involving MATRICES. Syntax: resource imageaffine( resource $image, array $affine, array $ 2 min read PHP | imagefilledrectangle() Function The imagefilledrectangle() function is an inbuilt function in PHP which is used to create a filled rectangle. This function creates a rectangle filled with a given color in the image. The top left corner of the image is (0, 0). Syntax: bool imagefilledrectangle( $image, $x1, $y1, $x2, $y2, $color ) 2 min read PHP | imagecopyresampled() function The imagecopyresampled() function is an inbuilt function in PHP which is used to copy a rectangular portion of one image to another image, smoothly interpolating pixel values so that, in particular, reducing the size of an image still retains a great deal of clarity.Syntax: bool imagecopyresampled( 2 min read PHP | imagegif() Function The imagegif() function is an inbuilt function in PHP which is used to create the GIF image file from the given image. If the image has been made transparent with imagecolortransparent() function, then GIF89a image format will generate otherwise GIF87a image format will generate. Syntax: bool imageg 2 min read PHP | imagebmp() Function The imagebmp() function is an inbuilt function in PHP which is used to return the output or save a BMP version of the given image. Syntax: bool imagebmp( resource $image, mixed $to, bool $compressed ) Parameters: This function accept three parameters as mentioned above and described below: $image: I 1 min read PHP | imagegd2() Function The imagegd2() function is an inbuilt function in PHP which is used to output GD2 image to browser or file. This is most useful to convert any other image type to gd2. The imagecreatefromgd2() function can be used to further read gd2 images. Syntax: bool imagegd2( resource $image, float $to, int $ch 2 min read PHP | imagefilter() Function The imagefilter() function is an inbuilt function in PHP which is used to apply an given filter on the image. Syntax: bool imagefilter( resource $image, int $filtertype, int $arg1, int $arg2, int $arg3, int $arg4 ) Parameters: This function accept six parameters as mentioned above and described belo 3 min read Like