<?php
declare(strict_types=1);

$source = imagecreate(2, 2);
imagecolorallocate($source, 255, 0, 0);
imagecolorallocate($source, 0, 0, 255);
$target = imagecreate(2, 2);
imagecolorallocate($target, 0, 0, 0);
imagepalettecopy($target, $source);
echo imagecolorstotal($target), "\n";
