imagecreate() function in PHP

The imagecreate() function is used to create a new image. It is preferred to use imagecreatetruecolor() to create an image instead of imagecreate(). This is because the image processing occurs on the highest quality image possible which can be created using imagecreatetruecolor().

Syntax

imagecreate( $width, $height )

Parameters

  • width: The width of image

  • height: The height of image

Return

The imagecreate() function returns an image resource identifier on success or FALSE on errors.

Example

The following is an example:

Output

The following is the output:

Updated on: 2019-12-31T06:25:14+05:30

7K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements