GD 라이브러리를 사용하여 PHP로 생성기를 작성하기 시작합니다. 내가 lib를 사용하여 일부 이미지를 생성했지만 그들은 좋은 품질을 가지고 있지 않습니다. 이미지의 품질을 향상시킬 수있는 방법이 있는지 알고 싶습니다.PHP GD 생성 이미지 품질 향상
생성 된 이미지이다
내가 만든 코드 :
<?php
$canvas = imagecreate(800, 350);
imagecolorallocate($canvas, 255, 255, 255);
$pink = imagecolorallocate($canvas, 255, 105, 180);
$white = imagecolorallocate($canvas, 255, 255, 255);
$green = imagecolorallocate($canvas, 132, 135, 28);
imagestring($canvas, 20, 290, 25, "Quality is not the best :(", $green);
function drawlinebox($x1, $y1, $x2, $y2, $height, $color){
global $canvas;
imagesetthickness ($canvas, 1);
for ($i=1; $i < $height; $i++){
imageline($canvas, $x1, $y1, $x2, $y2, $color);
$y1++; $y2++;
}
}
drawlinebox(20, 20, 780, 300, 30, $green);
drawlinebox(20, 300, 780, 20, 30, $pink);
header('Content-Type: image/jpeg');
imagejpeg($canvas);
imagedestroy($canvas);
?>
'imagejpeg'대신'imagepng'를 사용해보세요. PNG ('header ('Content-Type : image/png');')가 더 나은 형식 일 수 있습니다. –
안티 앨리어싱 기능을 사용해 보셨습니까? – kaiser