0
我試圖在上傳後調整圖像大小,但圖像質量受損。調整大小後的圖像質量不好
我已經測試了兩個2套代碼:
$im = new imagick($filename);
$im->setImageResolution(1250,1250);
$im->setImageColorspace(255);
$im->setCompression(Imagick::COMPRESSION_JPEG);
$im->setCompressionQuality(100);
$im->setImageFormat('jpeg');
$im->writeImage('thumb.jpg');
$im->clear();
$im->destroy();
這:
$newwidth = 460;
$newheight = 275;
$newwidth1 = 146;
$newheight2 = 88;
list($width, $height) = getimagesize($path);
$src = imagecreatefromjpeg($path);
imagecopyresampled($temp, $src, 0,0,0,0, $newwidth, $newheight, $width, $height);
Imagettftext($temp, 16, 0, $start_x, $start_y, $black2, $font , "text");
imagejpeg($temp, $path,75);
imagedestroy($temp);
$temp2 = imagecreatetruecolor($newwidth1, $newheight2);
imagecopyresampled($temp2, $src, 0,0,0,0, $newwidth1, $newheight2, $width, $height);
Imagettftext($temp2, 8, 0, $start_x2, $start_y2, $black2, $font , "text");
imagejpeg($temp2,$pathFile ,75);
imagedestroy($temp2);
imagedestroy($src);
他們都不是工作,我想。有什麼建議?
當然,重新調整大小的質量並不高。你期望什麼? – frosty
他們'質量不好'?你可以發佈樣本嗎? imagick有'imagick :: COMPRESSION_LOSSLESSJPEG' – Gavin