PHP | imagecolordeallocate() Function Last Updated : 23 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The imagecolordeallocate() function is an inbuilt function in PHP which is used to de-allocate a color created by imagecolorallocate() or imagecolorallocatealpha() function for an image. Syntax: bool imagecolordeallocate( $image, $color ) 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 the size of image. $color: This parameter holds the color identifier. Return Value: This function returns True on success or False on failure. Below programs illustrate the imagecolordeallocate() function in PHP: Program 1: php <?php // It create the size of image or blank image. $image_size = imagecreatetruecolor(500, 300); // Set the background color of image using // imagecolorallocate() function. $bg = imagecolorallocate($image_size, 0, 103, 0); // Use imagecolordeallocate() function to // deallocate the color $bg = imagecolordeallocate($image_size, $bg); // Fill background with above selected color. imagefill($image_size, 0, 0, $bg); // Output image in the browser header("Content-type: image/png"); imagepng($image_size); // free memory imagedestroy($image_size); ?> Output: Program 2: php <?php // It create the size of image or blank image. $image_size = imagecreatetruecolor(500, 300); // Set the background color of image. $bg = imagecolorallocate($image_size, 0, 103, 0); // Use imagecolordeallocate() function to // deallocate the color $bg = imagecolordeallocate($image_size, $bg); // Fill background with above selected color. imagefill($image_size, 0, 0, $bg); // Set the colors of image $white_color = imagecolorallocate($image_size, 255, 255, 255); // Draw a circle imagearc($image_size, 200, 150, 200, 200, 0, 360, $white_color); // Output image in the browser header("Content-type: image/png"); imagepng($image_size); ?> Output: Reference: https://www.php.net/manual/en/function.imagecolordeallocate.php Comment More infoAdvertise with us Next Article PHP | imagecolordeallocate() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | imagecolorallocate() Function The imagecolorallocate() function is an inbuilt function in PHP which is used to set the color in an image. This function returns a color which is given in RGB format. Syntax: int imagecolorallocate ( $image, $red, $green, $blue ) Parameters: This function accepts four parameters as mentioned above 2 min read PHP | imagecolorallocatealpha() Function The imagecolorallocatealpha() function is an inbuilt function in PHP which is used to allocate the color for an image. This function is same as imagecolorallocate() function with addition of transparency parameter $alpha. This function accepts five parameters and returns color identifier on true or 3 min read PHP | imagecolorexact() Function The imagecolorexact() function is an inbuilt function in PHP which is used to get the index of specified color in the palette of the image. In created image files only used colors in the image are resolved. Colors present only in the palette are not resolved. Syntax: int imagecolorexact ( $image, $r 2 min read PHP | imagecolorat() function The imagecolorat() function is an inbuilt function in PHP which is used to get the index of the color of the pixel. This function returns the pixel value at the specified location.Syntax:Â Â int imagecolorat( $image, $x, $y ) Parameters: This function accepts three parameters as mentioned above and d 2 min read PHP | imagecolorset() Function The imagecolorset() function is an inbuilt function in PHP which is used to set the color for the specified palette index. It is used to specify the index in the palette to the specified color. To perform the actual flood-fill, it is useful to create the flood-fill-like effects in palleted images wi 2 min read PHP | imagecreate() Function The imagecreate() function is an inbuilt function in PHP which is used to create a new image. This function returns the blank image of given size. In general imagecreatetruecolor() function is used instead of imagecreate() function because imagecreatetruecolor() function creates high quality images. 2 min read PHP | imagecolorresolve() Function The imagecolorresolve() function is an inbuilt function in PHP which is used to get the index of the specified color or its closest possible alternative color. This function returns a color index value for a requested color, either the exact matched color or the closest possible alternative. Syntax: 2 min read PHP | imagecolorclosest() Function The imagecolorclosest() function is an inbuilt function in PHP which is used to get the index of the closest color in the given image. This function returns the index of the color in the palette of the image which is closest to the specified RGB value. Syntax: int imagecolorclosest( $image, $red, $g 2 min read PHP | imagecolorexactalpha() Function The imagecolorexactalpha() function is an inbuilt function in PHP which is used to get the index of the specified color with alpha value. This function returns the index of the specified color and alpha value (RGBA value) in the palette of the image. Syntax: int imagecolorexactalpha ( $image, $red, 2 min read PHP | imagecolormatch() Function The imagecolormatch() function is an inbuilt function in PHP which is used to make the color of palette version of an image more closely match the true color version. This function returns true on success or false on failure. Syntax: bool imagecolormatch ( $image1, $image2 ) Parameters: This functio 2 min read Like