我有以下代码:
$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);
由于某种原因,调整大小的图像总是有点模糊,您可以在这里看到调整大小的图像和原始图像,这里是调整大小的图像。我已经没有想法为什么会这样了。知道为什么吗?