imagecolorclosesthwb
获取具有色调,白色和黑度的颜色的索引
<p><strong>适用PHP版本:</strong>PHP 5及以上版本</p>
<h2>函数说明</h2>
<p>该函数用于查找指定颜色与一个图像的调色板中最接近的颜色。颜色是通过 HWB (Hue, White, Black) 模型来表示的。该函数返回一个调色板索引,表示最接近指定颜色的索引。</p>
<h2>函数语法</h2>
<p>int imagecolorclosesthwb(resource $image, int $r, int $g, int $b)
首先创建了一个 100x100 像素的真彩色图像。然后定义了一个颜色的RGB值(红色为120,绿色为200,蓝色为255)。接下来,通过调用 imagecolorclosesthwb 函数查找与该颜色最接近的图像调色板索引,并将该索引输出。