이미지 처리 및 GD imagepalettecopy
(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)
imagepalettecopy — 한 이미지에서 다른 이미지로 팔레트 복사
설명
imagepalettecopy(GdImage $dst
, GdImage $src
): void
imagepalettecopy()는 src
이미지에서 dst
이미지로 팔레트를 복사합니다.
매개변수
dst
- 대상 이미지 개체입니다.
src
- 소스 이미지 개체입니다.
반환 값
값이 반환되지 않습니다.
변경 로그
버전 | 설명 |
---|---|
8.0.0 | dst 및 src 는 이제 GdImage 인스턴스를 반환합니다. 이전에는 리소스가 필요했습니다. |
Examples
예제 #1 imagepalettecopy() 예제
<?php
// Create two palette images
$palette1 = imagecreate(100, 100);
$palette2 = imagecreate(100, 100);
// Allocate the background to be
// green in the first palette image
$green = imagecolorallocate($palette1, 0, 255, 0);
// Copy the palette from image 1 to image 2
imagepalettecopy($palette2, $palette1);
// Since the palette is now copied we can use the
// green color allocated to image 1 without using
// imagecolorallocate() twice
imagefilledrectangle($palette2, 0, 0, 99, 99, $green);
// Output image to the browser
header('Content-type: image/png');
imagepng($palette2);
imagedestroy($palette1);
imagedestroy($palette2);
?>