Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> PHP

Hàm imagecolorclosesthwb() trong PHP

imagecolorclosesthwb() tìm index màu trong palette gần nhất theo mô hình HWB (Hue - Whiteness - Blackness), phù hợp hơn cho cảm giác thị giác người.

Cú pháp

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

Ví dụ

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