imagecolormatch

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

imagecolormatch使一个图像中调色板版本的颜色与真彩色版本更能匹配

说明

imagecolormatch ( resource $image1 , resource $image2 ) : bool

使一个图像中调色板版本的颜色与真彩色版本更能匹配。

参数

image1

真彩色图像连接资源。

image2

必须是调色板图像,而且和 image1 的大小必须相同。

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

Example #1 imagecolormatch() 例子

<?php
// Setup the true color and palette images
$im1 imagecreatefrompng('./gdlogo.png');
$im2 imagecreate(imagesx($im1), imagesy($im1));

// Add some colors to $im2
$colors   = Array();
$colors[] = imagecolorallocate($im22553674);
$colors[] = imagecolorallocate($im2400240);
$colors[] = imagecolorallocate($im282100255);
$colors[] = imagecolorallocate($im2846344);

// Match these colors with the true color image
imagecolormatch($im1$im2);

// Free from memory
imagedestroy($im1);
imagedestroy($im2);
?>

注释

Note: 此函数仅在与 GD 库捆绑编译的 PHP 版本中可用。

Note: 此函数需要 GD 2.0.1 或更高版本(推荐 2.0.28 及更高版本)。

参见

相关文章
php gd 和图像处理 函数 取得图像类型的文件后缀php gd 和图像处理 函数 取得 getimagesize,exif read data,exif thumbnail,exif imagetype 所返回的图像类型的 mime 类型php gd 和图像处理 函数 为一幅图像分配颜色php gd 和图像处理 函数 为一幅图像分配颜色 + alphaphp gd 和图像处理 函数 取得与指定的颜色加透明度最接近的颜色php gd 和图像处理 函数 取得与给定颜色最接近的色度的黑白色的索引php gd 和图像处理 函数 取消图像颜色的分配php gd 和图像处理 函数 使一个图像中调色板版本的颜色与真彩色版本更能匹配php gd 和图像处理 函数 给指定调色板索引设定颜色php gd 和图像处理 函数 取得一幅图像的调色板中颜色的数目php gd 和图像处理 函数 重采样拷贝部分图像并调整大小php gd 和图像处理 函数 新建一个基于调色板的图像php gd 和图像处理 函数 新建一个真彩色图像php gd 和图像处理 函数 使用 freetype 2 字体将文本写入图像php gd 和图像处理 函数 检查图像是否为真彩色图像php gd 和图像处理 函数 将调色板从一幅图像拷贝到另一幅php gd 和图像处理 函数 将真彩色图像转换为调色板图像php gd 和图像处理 函数 返回当前 php 版本所支持的图像类型php gd 和图像处理 函数 将 xbm 图像输出到浏览器或文件php gd 和图像处理 函数 将 png 图像文件转换为 wbmp 图像文件
关注编程学问公众号