PHP | imageopenpolygon() Function Last Updated : 31 Jan, 2020 Comments Improve Suggest changes Like Article Like Report The imageopenpolygon() function is an inbuilt function in PHP which is used to draws an open polygon. Syntax: bool imageopenpolygon( resource $image, array $points, int $num_points, int $color ) Parameters: This function accepts four parameters as mentioned above and described below: $image: It specifies the image resource to work on. $points: It specifies the points of polygon. $num_points: It specifies the number of points. $color: It specifies the color of polygon. Return Value: This function returns TRUE on success or FALSE on failure. Below examples illustrate the imageopenpolygon() function in PHP: Example 1: In this example, we will draw polygon on a blank drawing. php <?php // Create a blank image $image = imagecreatetruecolor(400, 300); // Prepare the colors $red = imagecolorallocate($image, 255, 0, 0); // Points of array $points = array( 80, 150, 150, 250, 300, 250, 370, 150, 230, 50, 80, 150 ); // Create an polygon imageopenpolygon($image, $points, 6, $red); // Output to browser header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> Output: Example 2: In this example, drawing polygon on a image. php <?php // Create an image instance $image = imagecreatefrompng( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Prepare the colors $red = imagecolorallocate($image, 255, 0, 0); // Points of array $points = array( 10, 10, 660, 10, 660, 100, 10, 100, 10, 10 ); // Create an polygon imageopenpolygon($image, $points, 5, $red); // Output to browser header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?> Output: Reference: https://www.php.net/manual/en/function.imageopenpolygon.php Comment More infoAdvertise with us Next Article PHP | imageopenpolygon() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP | imagepolygon() Function The imagepolygon() function is an inbuilt function in PHP which is used to draw a polygon. This function returns TRUE on success and returns FALSE otherwise.Syntax:Â bool imagepolygon( $image, $points, $num_points, $color ) Parameters: This function accepts four parameters as mentioned above and des 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 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 | imagesetinterpolation() Function The imagesetinterpolation() function is an inbuilt function in PHP which is used to set the interpolation method, setting an interpolation method affects the rendering of various functions such as the imagerotate() function.Syntax:Â Â bool imagesetinterpolation( resource $image, int $method )Parameter 2 min read PHP | imagecrop() Function The imagecrop() function is an inbuilt function in PHP which is used to crop an image to the given rectangle. This function crops an image to the given rectangular area and returns the resulting image. The given image is not modified. Syntax: resource imagecrop ( $image, $rect ) Parameters: This fun 1 min read Like