使一個影象中調色板版本的顏色與真彩色版本更能匹配

imagecolormatch

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

imagecolormatch — 使一個影象中調色板版本的顏色與真彩色版本更能匹配

說明

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

使一個影象中調色板版本的顏色與真彩色版本更能匹配。

參數

image1

真彩色影象連線資源。

image2

必須是調色板影象,而且和 image1 的大小必須相同。

返回值

成功時返回 true, 或者在失敗時返回 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($im2, 255, 36, 74);
$colors[] = imagecolorallocate($im2, 40, 0, 240);
$colors[] = imagecolorallocate($im2, 82, 100, 255);
$colors[] = imagecolorallocate($im2, 84, 63, 44);

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

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

註釋

參見

Leave a Reply

Your email address will not be published. Required fields are marked *