超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<imagecreatefromxpmimagedashedline>
Last updated: Fri, 22 Jun 2007

imagecreatetruecolor

(PHP 4 >= 4.0.6, PHP 5)

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

说明

resource imagecreatetruecolor ( int x_size, int y_size)

imagecreatetruecolor() 返回一个图像标识符,代表了一幅大小为 x_sizey_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 或更高版本。

注: 本函数不能用于 GIF 文件格式。

参见 imagedestroy()imagecreate()




add a note 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.

<imagecreatefromxpmimagedashedline>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22