PHP imagecolorclosesthwb - 取得与指定的颜色最接近的色度的黑白色的索引

PHP 教程 · 2019-01-31 11:11:53

imagecolorclosesthwb — 取得与指定的颜色最接近的色度的黑白色的索引。

语法

int imagecolorclosesthwb ( resource $image , int $red , int $green , int $blue )

取得与给定颜色最接近的色度的黑白色的索引。

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

参数

  • image 由图像创建函数(例如 imagecreatetruecolor())返回的图像资源。
  • red 红色成分的值。
  • green 绿色成分的值。
  • blue 蓝色成分的值。

返回值

返回一个整数,是给定颜色最接近的色度的黑白色的索引。

实例

<?php
$im = imagecreatefromgif('php.gif');

echo 'HWB: ' . imagecolorclosesthwb($im, 116, 115, 152);

imagedestroy($im);
?>

以上实例的输出类似于:

HWB: 33

相关文章

  • imagecolorclosest() 取得与指定的颜色最接近的颜色的索引值。

点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

Domain-Driven Design

Domain-Driven Design

Eric Evans / Addison-Wesley Professional / 2003-8-30 / USD 74.99

"Eric Evans has written a fantastic book on how you can make the design of your software match your mental model of the problem domain you are addressing. "His book is very compatible with XP. It is n......一起来看看 《Domain-Driven Design》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具