A WordPress-centric search engine for devs and theme authors



wp_imagecreatetruecolor ›

Since2.9.0
Deprecatedn/a
wp_imagecreatetruecolor ( $width, $height )
Parameters: (2)
  • (int) $width Image width in pixels.
    Required: Yes
  • (int) $height Image height in pixels.
    Required: Yes
Returns:
  • (resource|GdImage) The GD image resource or GdImage instance.
Defined at:
Codex:

Create new GD image resource with transparency support



Source

function wp_imagecreatetruecolor( $width, $height ) {
	$img = imagecreatetruecolor( $width, $height );

	if ( is_gd_image( $img )
		&& function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' )
	) {
		imagealphablending( $img, false );
		imagesavealpha( $img, true );
	}

	return $img;
}