imagecolorexact() tìm index của màu RGB chính xác trong palette. Trả về -1 nếu không tồn tại.
Cú pháp
imagecolorexact(resource $image, int $red, int $green, int $blue): int
Ví dụ
<?php
$img = imagecreatefrompng('https://example.com/image.png');
$colors[] = imagecolorexact($img, 30, 90, 50);
$colors[] = imagecolorexact($img, 80, 120, 100);
$colors[] = imagecolorexact($img, 25, 80, 50);
print_r($colors); // Array([0]=>1989170 [1]=>5273700 [2]=>1658930)
imagedestroy($img);
?>
Khác với imagecolorclosest() (tìm gần nhất), imagecolorexact() yêu cầu khớp tuyệt đối.