PHP | imagefill() Function Last Updated : 23 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The imagefill() function is an inbuilt function in PHP which is used to fill the image with the given color. This function performs a flood fill starting at the given coordinate (top left is 0, 0) with the given color in the image. Syntax: bool imagefill( $image, $x, $y, $color ) Parameters:This function accepts four 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. $x: This parameter is used to set x-coordinate of starting point. $y: This parameter is used to set y-coordinate of starting point. $color: It sets the color of image. A color identifier created by imagecolorallocate() function. Return Value: This function returns True on success of False on failure. Below programs illustrate the imagefill() function in PHP: Program 1: php <?php // Create an image of given size $image = imagecreatetruecolor(500, 400); // Sets background to green $green = imagecolorallocate($image, 0, 153, 0); imagefill($image, 0, 0, $green); header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> Output: Program 2: php <?php // It create the size of image or blank image. $image = imagecreatetruecolor(500, 300); // Set the background color of image. $bg = imagecolorallocate($image, 205, 220, 200); // Fill background with above selected color. imagefill($image, 0, 0, $bg); // Set the color of an ellipse. $col_ellipse = imagecolorallocate($image, 0, 102, 0); // Function to draw the filled ellipse. imagefilledellipse($image, 250, 150, 400, 250, $col_ellipse); // Output of the image. header("Content-type: image/png"); imagepng($image); ?> Output: Related Articles: PHP | imagecolorallocatealpha() Function PHP | imagearc() Function PHP | imageellipse() Function Reference: http://php.net/manual/en/function.imagefill.php Comment More infoAdvertise with us Next Article PHP | imagefill() Function V vijay_raj Follow Improve Article Tags : Misc Web Technologies PHP Image-Processing PHP-function +1 More Practice Tags : Misc Similar Reads PHP | imagefilledarc() Function The imagefilledarc() function is an inbuilt function in PHP which is used to draws a partial arc centered at the specified coordinate in the given image. This function return True on success or False on failure Syntax: bool imagefilledarc ( $image, $cx, $cy, $width, $height, $start, $end, $color, $s 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 | 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 | imagesx() Function The imagesx() function is an inbuilt function in PHP which is used to return the width of the given image. Syntax: int imagesx( $image ) Parameters: This function accepts single parameters $image which is mandatory. This $image variable can store the image created by imagecreatetruecolor() image cre 1 min read PHP | imagesy() Function The imagesy() function is an inbuilt function in PHP which is used to return the height of the given image. Syntax: int imagesy( $image ) Parameters: This function accepts single parameters $image which is mandatory. This $image variable store the image created by imagecreatetruecolor() image creati 1 min read PHP | imageline() Function The imageline() function is an inbuilt function in PHP which is used to set the draws a line between the two given points. Syntax: bool imageline( resource $image, int $x1, int $y1, int $x2, int $y2, int $color ) Parameters: This function accepts six parameters as mentioned above and described below 2 min read PHP | imagefilltoborder() Function The imagefilltoborder() function is an inbuilt function in PHP which is used to performs a flood fill with a specific color and add a border with a border color. Syntax: bool imagefilltoborder( resource $image, int $x, int $y, int $border, int $color ) Parameters: This function accept five parameter 2 min read PHP | imagesettile() Function The imagesettile() function is an inbuilt function in PHP which is used to set the tile image for filling the area. Syntax: bool imagesettile( $image, $tile ) Parameters: This function accepts two parameters as mentioned above and described below: $image: It is returned by one of the image creation 2 min read 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 | imagefilledpolygon() Function The imagefilledpolygon() function is an inbuilt function in PHP which is used to draw a filled polygon. This function Returns TRUE on success and returns FALSE otherwise. Syntax:Â bool imagefilledpolygon( $image, $points, $num_points, $color ) Parameters: This function accepts four parameters as men 2 min read Like