PHP imagecreatefromjpeg和imagecopy在图像上创建了Pixelate和非常差的质量

Arm*_*iaH 2 php gd image-processing

使用此代码后(只是处理图像的部分)

$image = imagecreatefromjpeg($filename);
$new_width = $thumbnail_width;
$new_height = $thumbnail_height;
$start_width = 0;
$start_height = 0;
$start_width = ($thumbnail_width - $image_params[0]) / 2;
$start_height = ($thumbnail_height - $image_params[1]) / 2;
imagecopy($image_res, $image, $start_width, $start_height, 0, 0, $image_params[0], $image_params[1]);
Run Code Online (Sandbox Code Playgroud)

我得到非常差的像素化结果,你可以在这里看到它 在此输入图像描述

这是原始图像

在此输入图像描述

PHP版本5.3.18

捆绑的GD版本(2.0.34兼容)

使用GD对我来说是必须的.这个例子在许多服务器上工作得非常好,但在某些情况下,我得到了这个可怕的结果,我想知道原因.

有什么帮助吗?

fdr*_*drv 5

指定质量百分比时,我已解决了同样的问题.

imagejpeg($im, 'watemark.jpg', 100);
Run Code Online (Sandbox Code Playgroud)

或75以下等

http://php.net/manual/en/function.imagejpeg.php