TUTORIAL后端与 Web 服务FETCHED
PHP imagecreate - 新建一个基于调色板的图像
PHP imagecreate - 新建一个基于调色板的图像 PHP 图像处理 imagecolorallocate — 新建一个基于调色板的图像。 语法 imagecreate ( int $x_size , int $y_size ) : resource imagecolorallocate() 返回一个图像标识符,代表了一幅大小为 x_size 和 y_size 的空白图像。 实例 PHP 图像处理..
更新于 2026/7/16
教程详情页默认 noindex。
PHP imagecreate - 新建一个基于调色板的图像
imagecolorallocate — 新建一个基于调色板的图像。
语法
imagecreate ( int $x_size , int $y_size ) : resource
imagecolorallocate() 返回一个图像标识符,代表了一幅大小为 x_size 和 y_size 的空白图像。
实例
<?php
header("Content-type: image/png");
$im = @imagecreate(100, 50)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
PHP 图像处理