Imagecreatetruecolor()PHP函数

The imagecreatetruecolor() function is used in PHP to create a new true color image using the GD Library. True color uses a 24-bit color depth when displaying an RGB image. Its two parameters are the width and height of the image you are creating.

PHP中使用imagecreatetruecolor()函数使用GD Library创建新的真彩色图像。 真彩色在显示RGB图像时使用24位色深。 它的两个参数是所创建图像的宽度和高度。

使用Imagecreatetruecolor()函数的示例代码 ( Sample Code Using Imagecreatetruecolor() Function )

This code generates a PNG image that is 130 pixels wide by 50 pixels high. The imagecreatetruecolor() function specifies a shape that is 130 pixels wide by 50 pixels high. The text color is set using RGB values. The text that will print on the shape is "A Simple Text String," in size 1 (of 1-5) with an x ordinate of 5 and a y-ordinate of 5.

此代码生成一个130像素宽x 50像素高的PNG图像。 imagecreatetruecolor()函数指定的形状为130像素宽x 50像素高。 文字颜色是使用RGB值设置的。 将在形状上打印的文本是“简单文本字符串”,大小为1(1-5),x坐标为5,y坐标为5。

返回值 ( Return Values )

When successful, this function returns an image identifier that represents a black image of the specified size. If not successful, it returns "False."

成功后,此函数将返回一个图像标识符,该标识符表示指定大小的黑色图像。 如果不成功,则返回“ False”。

注意事项 ( Considerations )

The GD library must be enabled for this function to work properly; otherwise, the return value is False. It can be downloaded free from the internet if you don't already have it installed.

必须启用GD库,此功能才能正常工作; 否则,返回值为False。 如果尚未安装,则可以从互联网上免费下载。

Imagecreatetruecolor()与Imagecreate()函数 ( Imagecreatetruecolor() vs. Imagecreate() Function )

Although the imagecreate() function still works in PHP, the PHP manual recommends the use of the newer imagecreatetruecolor() function, which

尽管imagecreate()函数仍可在PHP中使用,但PHP手册建议使用较新的imagecreatetruecolor()函数,该函数

  • creates images with many more colors

    创建更多颜色的图像
  • makes color transparency possible

    使颜色透明成为可能
  • allows advanced image processes

    允许高级图像处理

翻译自: https://www.thoughtco.com/imagecreatetruecolor-php-function-2694064

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值