Вопрос

i am creating a thumbnail from my pictures but the result have a low quality! and colors are mixed. what can i do for this?

part of my code:

$thumb = imagecreatetruecolor($newWidth,$newHeight);
$source = imagecreatefromjpeg($srcImage);
imagecopyresized($thumb,$source,0,0,0,0,$newWidth,$newHeight,$width,$height);
imagejpeg($thumb,$desImage);
Это было полезно?

Решение

Replace imagecopyresized with imagecopyresampled to make the resizing better.

Then you can change the third argument to imagejpeg to change the quality of the save. The default is 75 and max is 100.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top