array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.imagecreatetruecolor.php', 1 => 'imagecreatetruecolor', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'GD 和图像处理 函数', ), 'prev' => array ( 0 => 'function.imagecreatefromxpm.php', 1 => 'imagecreatefromxpm', ), 'next' => array ( 0 => 'function.imagecrop.php', 1 => 'imagecrop', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/image/functions/imagecreatetruecolor.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
imagecreatetruecolor — 新建真彩色图像
imagecreatetruecolor() 返回图像对象,表示指定大小的黑色图像。
width
图像宽度。
height
图像高度。
成功后返回图象对象,失败后返回 false
。
示例 #1 新建 GD 图像流并输出图像。
<?php
header ('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);
?>
以上示例的输出类似于: