Question

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);
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top