imagecolorexact() फंक्शन निर्दिष्ट रंग का इंडेक्स प्राप्त करता है।
सिंटैक्स
imagecolorexact ( $img, $red, $green, $blue )
पैरामीटर्स
img: imagecreatetruecolor() के साथ बनाया गया इमेज रिसोर्स।
red: लाल रंग घटक
green: हरा रंग घटक
blue: नीला रंग घटक
रिटर्न
imagecolorexact() फंक्शन पैलेट में निर्दिष्ट रंग का इंडेक्स लौटाता है, या -1 यदि रंग मौजूद नहीं है।
उदाहरण
निम्नलिखित एक उदाहरण है:
<?php
$img = imagecreatefrompng('https://www.tutorialspoint.com/assets/videos/courses/67/images/course_67_image.png');
$colors = Array();
$colors[] = imagecolorexact($img, 30, 90, 50);
$colors[] = imagecolorexact($img, 80, 120, 100);
$colors[] = imagecolorexact($img, 25, 80, 50);
print_r($colors);
imagedestroy($img);
?>
आउटपुट
निम्नलिखित आउटपुट है:
Array ( [0] => 1989170 [1] => 5273700 [2] => 1658930 )