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