我有以下代碼:使用試想束調整圖像大小模糊圖像
$imagine = new \Imagine\Gd\Imagine();
$image = $imagine->open($src);
$image_size = $image->getSize();
$image_height = $image_size->getHeight();
$image_width = $image_size->getWidth();
$ratio = 1;
$resized_image = $image;
$ratio = $image_width/$desired_width;
$this->resizedHeight = $image_height/$ratio;
$this->resizedWidth = $image_width/$ratio;
// thumbnailDir doesn t exist
if(!is_dir(dirname($des)))
mkdir(dirname($des), 0777, true);
$resized_image = $image->resize(new Box($this->resizedWidth, $this->resizedHeight));
$options = array(
'resolution-units' => ImageInterface::RESOLUTION_PIXELSPERINCH,
'resolution-x' => 500,
'resolution-y' => 500,
'flatten' => false
);
$resized_image->save($des, $options);
出於某種原因,調整後的圖像總是有點模糊,你可以在這裏看到調整後的圖像與原始圖像here和here's的調整大小的圖像。爲什麼這是我的想法。任何想法爲什麼?
其值爲'ImageInterface :: RESOLUTION_PIXELSPERINCH'持有? – schoash