私は、PHPを使用して画像に透かしとして透明なロゴを追加しています。しかし、その結果、ロゴの品質は悪いです(その下にあるイメージは高品質なので、透かしだけです)。これは私が(その最後の3行程度)を使用するコードです:ウォーターマークとしてのロゴの追加、透かしの品質の悪い
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);
あなたの本当の質問は何ですか? – Blueblazer172
なぜimagecopyresizedを使用して透かしの品質が悪いのですか? –