PHP 4, PHP 5, PHP 7, PHP 8
imagecreate - Create a new palette based image
Code Examples

imagecreate( int$width, int$height ): GdImage|false

imagecreate returns an image identifier representing a blank image of specified size.

In general, we recommend the use of imagecreatetruecolor instead of imagecreate so that image processing occurs on the highest quality image possible. If you want to output a palette image, then imagetruecolortopalette should be called immediately before saving the image with imagepng or imagegif.



The image width.


The image height.

Return Values

Returns an image object on success, false on errors.


Version Description
8.0.0 On success, this function returns a GDImage instance now; previously, a resource was returned.

Related Functions

Example of imagecreate

Show all examples for imagecreate

PHP Version:

Function imagecreate:

Image Processing and GD Functions

Most used PHP functions