HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagepalettecopy

Description

The imagepalettecopy of Image for PHP copy the palette from one image to another.

Syntax

imagepalettecopy(
    GdImage $dst,
    GdImage $src
): void

Parameters

dst

The destination image object.

src

The source image object.

Return

No value is returned.

Examples

1 · dst src

<?

$width = 100;
$height = 100;
$dst = imagecreate($width, $height);

$width = 100;
$height = 100;
$src = imagecreate($width, $height);

$red = 0;
$green = 0;
$blue = 0;
imagecolorallocate($src, $red, $green, $blue);

imagepalettecopy($dst, $src);

var_dump($dst);
object(GdImage)#1 (0) {
}

2 · base64

<?

$width = 100;
$height = 100;
$dst = imagecreate($width, $height);

$width = 100;
$height = 100;
$src = imagecreate($width, $height);

$red = 0;
$green = 0;
$blue = 0;
imagecolorallocate($src, $red, $green, $blue);

imagepalettecopy($dst, $src);

ob_start();

    imagepng($dst);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';
<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAQMAAABKLAcXAAAAA1BMVEUAAACnej3aAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAFElEQVQ4jWNgGAWjYBSMglFATwAABXgAAfmlXscAAAAASUVORK5CYII=">
</body>
</html>