PHP 中的 imagecolorclosesthwb() 函数


imagecolorclosesthwb() 函数获取具有色相、白色和黑色成分的颜色索引

语法

imagecolorclosesthwb ( $img, $red, $green, $blue )

参数

  • img: 使用 imagecreatetruecolor() 创建图像

  • 红色: 红色颜色组件

  • 绿色: 绿色颜色组件

  • 蓝色: 蓝色颜色组件

返回值

imagecolorclosesthwb() 函数返回一个整数,该整数包含与给定颜色最接近的色相、白色和黑色成分颜色的索引。

示例

以下是一个示例

 在线演示

<?php
   $img = imagecreatefromgif('https://tutorialspoint.com/images/html.gif');
   echo 'HWB = '. imagecolorclosesthwb($img, 50, 110, 90);
   imagedestroy($img);
?>

输出

以下为输出

HWB = 87

更新于: 31-12-2019

33 次浏览

开启您的 职业生涯

通过完成课程认证

开始学习
广告
© . All rights reserved.