<?php
declare(strict_types=1);

$photo = imagecreatetruecolor(40, 30);
imagefill($photo, 0, 0, imagecolorallocate($photo, 255, 255, 255));
$stamp = imagecreatetruecolor(8, 6);
imagealphablending($stamp, false);
imagesavealpha($stamp, true);
$red = imagecolorallocatealpha($stamp, 255, 0, 0, 64);
imagefill($stamp, 0, 0, $red);
$margin = 3;
$x = imagesx($photo) - imagesx($stamp) - $margin;
$y = imagesy($photo) - imagesy($stamp) - $margin;
imagealphablending($photo, true);
imagecopy($photo, $stamp, $x, $y, 0, 0, imagesx($stamp), imagesy($stamp));
$pixel = imagecolorsforindex($photo, imagecolorat($photo, $x, $y));
echo $x, ",", $y, "\n";
echo $pixel["red"] === 255 && $pixel["green"] > 0 && $pixel["green"] < 255 ? "red blended with white\n" : "unexpected\n";
