Ich füge ein transparentes Logo als Wasserzeichen über einem Bild mit PHP hinzu. Im Ergebnis hat das Logo jedoch eine schlechte Qualität (das darunter liegende Bild ist von hoher Qualität, also ist es nur das Wasserzeichen). Dies ist der Code, den ich verwende (es geht um die letzten drei Zeilen):Logo als Wasserzeichen hinzufügen, Wasserzeichen schlechte Qualität
header("Content-Type: image/png");
$photo = imagecreatefromjpeg('photos/'.$photo['image']);
$height = imagesx($photo);
$width = imagesx($photo);
if ($width > $_POST['width']) {
$r = $width/$_POST['width'];
$newwidth = $width/$r;
$newheight = $height/$r;
}
$image = imagecreatetruecolor($width, $height);
$image2 = imagecopyresampled($image, $photo, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
$position = explode(" ", $_POST['background']);
$image3 = imagecrop($image, [
'x' => str_replace(array('-', 'px'), array('', ''), $position[0]),
'y' => str_replace(array('-', 'px'), array('', ''), $position[1]),
'width' => $_POST['width'],
'height' => $_POST['height']
]);
$stamp = imagecreatefrompng('img/logo.png');
imagecopyresized($image3, $stamp, 0, 0, 0, 0, 147, 50, imagesx($stamp), imagesy($stamp));
imagepng($image3, "created/".time().".png", 9);
was ist Ihre wahre Frage? – Blueblazer172
Warum das Wasserzeichen ist so schlechte Qualität mit Bildkopie resized –