ইমেজপ্যালেটকপি() একটি অন্তর্নির্মিত PHP ফাংশন যা প্যালেটটিকে একটি চিত্র থেকে অন্য চিত্রে অনুলিপি করতে ব্যবহৃত হয়। এই ফাংশনটি উৎস চিত্র থেকে গন্তব্য চিত্রে প্যালেট অনুলিপি করে।
সিনট্যাক্স
void imagepalettecopy(resource $destination, resource $source)
পরামিতি
ইমেজপ্যালেটকপি() দুটি প্যারামিটার গ্রহণ করে - $source এবং $গন্তব্য .
-
$গন্তব্য - গন্তব্য চিত্র সংস্থান নির্দিষ্ট করে৷
৷ -
$source − সোর্স ইমেজ রিসোর্স নির্দিষ্ট করে।
রিটার্ন মান
ইমেজপ্যালেটকপি() কোনো মান ফেরত দেয় না।
উদাহরণ 1
<?php
// Create two palette images using imagecreate() function.
$palette1 = imagecreate(700, 300);
$palette2 = imagecreate(700, 300);
// Allocate the background to be
// gray in the first palette image
$gray = imagecolorallocate($palette1, 122, 122, 122);
// Copy the palette from image 1 to image 2
imagepalettecopy($palette2, $palette1);
// gray color allocated to image 1 without using
// imagecolorallocate() twice
imagefilledrectangle($palette2, 0, 0, 99, 99, $gray);
// Output image to the browser
header('Content-type: image/png');
imagepng($palette2);
imagedestroy($palette1);
imagedestroy($palette2);
?> আউটপুট

উদাহরণ 2
<?php // Created two palette images using imagecreate() function. $palette1 = imagecreate(500, 200); $palette2 = imagecreate(500, 200); // Create a gray color $gray= imagecolorallocate($palette1, 0, 255, 0); // gray color as the background to palette 1 imagefilledrectangle($palette1, 0, 0, 99, 99, $gray); // Copy the palette from image 1 to image 2 imagepalettecopy($palette2, $palette1); // Get the number of colors in the image $color1 = imagecolorstotal($palette1); $color2 = imagecolorstotal($palette2); echo "Colors in image 1 are " . $color1 . "<br>"; echo "Colors in image 2 is " . $color2; ?>
আউটপুট
Colors in image 1 are 1 Colors in image 2 are 1৷