wp_imagecreatetruecolor( int $width, int $height )

Create new GD image resource with transparency support

Parameters

$width

(int) (Required) Image width in pixels.

$height

(int) (Required) Image height in pixels.

Return

(resource|GdImage|false) The GD image resource or GdImage instance on success. False on failure.

Source

File: wp-includes/media.php

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;
}

Changelog

Version Description
2.9.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_imagecreatetruecolor