imagecolormatch() फंक्शन पैलेट वर्जन की इमेज के रंगों को ट्रू कलर वर्जन से अधिक निकटता से मिलान करता है।
सिंटैक्स
bool imagecolormatch ( img1, img2 )
पैरामीटर्स
img1: imagecreatetruecolor() फंक्शन के साथ इमेज बनाएं।
img2: एक पैलेट इमेज लिंक रिसोर्स जो इमेज की ओर इंगित करता है। इस इमेज का आकार img1 के समान है।
रिटर्न
imagecolormatch() फंक्शन सफलता पर TRUE या विफलता पर FALSE लौटाता है।
उदाहरण
निम्नलिखित एक उदाहरण है
<?php
$img1 = imagecreatefrompng('https://www.tutorialspoint.com/images/Swift.png');
$img2 = imagecreate(imagesx($img1), imagesy($img1));
$color = Array();
$color[] = imagecolorallocate($img2, 110, 40, 180);
$color[] = imagecolorallocate($img2, 90, 10, 90);
$color[] = imagecolorallocate($img2, 66, 170, 110);
$color[] = imagecolorallocate($img2, 130,90, 70);
echo imagecolormatch($img1, $img2);
imagedestroy($img1);
imagedestroy($img2);
?>
आउटपुट
निम्नलिखित आउटपुट है:
1
उदाहरण
आइए एक और उदाहरण देखें
<?php
$img1 = imagecreatefrompng('https://www.tutorialspoint.com/images/tp-logo-diamond.png');
$img2 = imagecreate(imagesx($img1), imagesy($img1));
$color = Array();
$color[] = imagecolorallocate($img2, 10, 1, 20);
$color[] = imagecolorallocate($img2, 40, 30, 10);
$color[] = imagecolorallocate($img2, 15, 100, 50);
$color[] = imagecolorallocate($img2, 70, 20, 30);
echo imagecolormatch($img1, $img2);
imagedestroy($img1);
imagedestroy($img2);
?>
आउटपुट
निम्नलिखित आउटपुट है:
1