首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

imagecreatetruecolor

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

imagecreatetruecolor - 创建一个新的真彩色图像

描述

代码语言:javascript
复制
resource imagecreatetruecolor ( int $width , int $height )

imagecreatetruecolor()返回一个图像标识符,表示指定大小的黑色图像。

参数

width

图像宽度。

height

图像高度。

返回值

成功时返回图像资源标识符,FALSE错误。

示例

示例#1创建一个新的 GD 图像流并输出图像。

代码语言:javascript
复制
<?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);
?>

上面的例子会输出类似于:

也可以看看

  • imagedestroy() - 销毁图像
  • imagecreate() - 创建一个新的基于调色板的图像

← imagecreatefromxpm

imagecrop →

扫码关注腾讯云开发者

领取腾讯云代金券