PHP | imagecreatetruecolor() Function Last Updated : 23 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The imagecreatetruecolor() function is an inbuilt function in PHP which is used to create a new true-color image. This function returns a blank image of the given size. Syntax: resource imagecreatetruecolor( $width, $height ) Parameters: This function accepts two parameters as mentioned above and described below: $width: This parameter is used to set the width of image. $height: This parameter is used to set the height of image. Return Value: This function returns an image resource identifier on success, or False on errors. Below programs illustrate the imagecreatetruecolor() function in PHP: Program 1: php <?php // Set the vertices of polygon $values = array( 150, 50, // Point 1 (x, y) 50, 250, // Point 2 (x, y) 250, 250 // Point 3 (x, y) ); // Create the size of image or blank image $image = imagecreatetruecolor(300, 300); // Set the background color of image $background_color = imagecolorallocate($image, 0, 153, 0); // Fill background with above selected color imagefill($image, 0, 0, $background_color); // Allocate a color for the polygon $image_color = imagecolorallocate($image, 255, 255, 255); // Draw the polygon imagepolygon($image, $values, 3, $image_color); // Output the picture to the browser header('Content-type: image/png'); imagepng($image); ?> output: Program 2: php <?php // Create the size of image or blank image. $image = imagecreatetruecolor(500, 300); // Display the height of image. echo imagesy($image); ?> output: 300 Related Articles: PHP | imagecolortransparent() Function PHP | imagepolygon() Function Reference: http://php.net/manual/en/function.imagecreatetruecolor.php Comment More infoAdvertise with us Next Article PHP | imagecreatetruecolor() Function V vijay_raj Follow Improve Article Tags : Misc Web Technologies PHP Image-Processing PHP-function +1 More Practice Tags : Misc Similar Reads PHP | imagepalettetotruecolor() Function The imagepalettetotruecolor() function is an inbuilt function in PHP which is used to convert an palette based image to true color.Syntax:Â Â bool imagepalettetotruecolor( resource $src ) Parameters: This function accepts a single parameter $src which holds the image to work on.Return Value: This fun 2 min read PHP | imageistruecolor() function The imageistruecolor() function is an inbuilt function in PHP which is used to find whether an image is a true-color image or not. A true-color image is an image in which each pixel is specified by three values, ie, RGB. Syntax: bool imageistruecolor( resource $image ) Parameters:This function accep 1 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 | imagecreatefrompng() Function The imagecreatefrompng() function is an inbuilt function in PHP which is used to create a new image from PNG file or URL. This image can be further worked upon in the program. This function is usually used when you want to edit your PNG images. Syntax: resource imagecreatefrompng( string $filename ) 1 min read PHP | imagecreatefromstring() Function The imagecreatefromstring() function is an inbuilt function in PHP which is used to create a new image from string file or URL. This image can be further worked upon in the program. This function is usually used when you want to edit your images after loading them from a string. Syntax: resource ima 2 min read PHP | imagecreatefrombmp() Function The imagecreatefrombmp() function is an inbuilt function in PHP which is used to create a new image from file or URL. Syntax: resource imagecreatefrombmp( string $filename ) Parameters: This function accepts a single parameter $filename which holds the name or URL of a file. Return Value: This funct 1 min read PHP | imagecreatefromgd2() function The imagecreatefromgd2() function is an inbuilt function in PHP which is used to create a new image from file or URL. Further, this image can be worked upon in the program. Usually, gd2 extension is not supported in the browser thus it can be used to convert it into png and view it in the browser.Sy 1 min read PHP | imagecreatefromxpm() Function The imagecreatefromxpm() function is an inbuilt function in PHP which is used to create a new image from XPM file or URL. XPM (X PixMap) is an image file format used by the X Window System. This loaded image can be further worked upon in the program. This function is usually used when you want to ed 2 min read PHP | imagecreatefromwbmp() Function The imagecreatefromwbmp() function is an inbuilt function in PHP which is used to create a new image from WBMP file or URL. WBMP (Wireless Application Protocol Bitmap Format) is a monochrome graphics file format optimized for mobile computing devices. This loaded image can be further worked upon in 2 min read PHP | imagecreatefromjpeg() Function The imagecreatefromjpeg() function is an inbuilt function in PHP which is used to create a new image from JPEG file or URL. This image can be further worked upon in the program. Syntax: resource imagecreatefromjpeg( string $filename ) Parameters: This function accepts a single parameter, $filename w 1 min read Like