= 4.3.0, PHP 5, PHP 7, PHP 8)imagecolormatch — 使一個(gè)圖像中調(diào)色板版本的顏色與真彩色版本更能匹配說(shuō)明imagecolormatch(resource $image1, resource $image2): b">

imagecolormatch

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

imagecolormatch使一個(gè)圖像中調(diào)色板版本的顏色與真彩色版本更能匹配

說(shuō)明

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

使一個(gè)圖像中調(diào)色板版本的顏色與真彩色版本更能匹配。

參數(shù)

image1

真彩色圖像連接資源。

image2

必須是調(diào)色板圖像,而且和 image1 的大小必須相同。

返回值

成功時(shí)返回 true, 或者在失敗時(shí)返回 false

范例

示例 #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);
?>

注釋

參見(jiàn)