|
|
 |
imagecreatetruecolor (PHP 4 >= 4.0.6, PHP 5) imagecreatetruecolor -- 新建一个真彩色图像 说明resource imagecreatetruecolor ( int x_size, int y_size)
imagecreatetruecolor() 返回一个图像标识符,代表了一幅大小为
x_size 和 y_size 的黑色图像。
例子 1. 新建一个新的 GD 图像流并输出图像 |
<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor (50, 100)
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);
?>
|
|
注:
本函数添加于 PHP 4.0.6 并需要 GD 2.0.1 或更高版本。
参见 imagedestroy() 和
imagecreate()。
add a note
User Contributed Notes
imagecreatetruecolor
steve at stevegodwin dot com
01-Jul-2001 08:22
ImageCreateTrueColor is used to create an image resource with an unlimited
number of colors, which is useful when manipulating JPEG images, for
example.
ImageCreate is used to create an image resource with a
256 color palette, sometimes called indexed color.
In previous
versions, ImageCreate worked OK for manipulating JPEG images. But in
experimenting with the Win32 version of PHP 4.0.6, which I think relies on
the GD 2.0.1 lib beta, you have to use ImageCreateTrueColor to get accurate
color results with JPEGs.
| |